public class MethodUnderTestDuration extends Object
Intercept or Duration annotation.
For example the below code specifies the annotation Duration at the field ItemService. This means
that this service will be proxied by EasyTest and EasyTest will try to capture the duration it took
for the method of the class ItemService and compare it with the expectedTimeInMillis attribute.
All this information is captured by EasyTest inside this class's instance in order to provide the reporting functionality
with all the requisite information it requires to produce a report.
public class ItemServiceTest {
@Duration(timeInMillis=30)
private ItemService itemService
public Item testGetItem(@Param(name="itemType") String itemType , @Param(name="expectedItem")Item expectedItem) {
Item item = itemService.getItem(itemType);
Assert.assertNotNull(item);
Assert.assertEquals(expectedItem , item);
return item;
}
| Constructor and Description |
|---|
MethodUnderTestDuration() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
Long |
getActualDurationinMillis() |
String |
getClassName()
Get the name of the class under test
|
Class<?> |
getClassUnderTest() |
Long |
getExpectedDurationinMillis() |
Object[] |
getMethodArguments()
Get the arguments to the
methodUnderTest |
String |
getMethodName()
Get the name of the method under test
|
Object |
getMethodResult()
Get the result returned by
methodUnderTest |
Method |
getMethodUnderTest() |
int |
hashCode() |
void |
setActualDurationinMillis(Long actualDurationinMillis) |
void |
setClassUnderTest(Class<?> classUnderTest) |
void |
setExpectedDurationinMillis(Long expectedDurationinMillis) |
void |
setMethodArguments(Object[] methodArguments)
Set the arguments to the
methodUnderTest |
void |
setMethodResult(Object methodResult)
Set the result returned by
methodUnderTest |
void |
setMethodUnderTest(Method methodUnderTest) |
public Object[] getMethodArguments()
methodUnderTestpublic void setMethodArguments(Object[] methodArguments)
methodUnderTestmethodArguments - the methodArguments to setpublic Object getMethodResult()
methodUnderTestpublic void setMethodResult(Object methodResult)
methodUnderTestmethodResult - the methodResult to setpublic Class<?> getClassUnderTest()
classUnderTestpublic void setClassUnderTest(Class<?> classUnderTest)
classUnderTest - the classUnderTest to setclassUnderTestpublic Method getMethodUnderTest()
methodUnderTestpublic void setMethodUnderTest(Method methodUnderTest)
methodUnderTest - the methodUnderTest to setmethodUnderTestpublic Long getExpectedDurationinMillis()
expectedDurationinMillispublic void setExpectedDurationinMillis(Long expectedDurationinMillis)
expectedDurationinMillis - the expectedDurationinMillis to setexpectedDurationinMillispublic Long getActualDurationinMillis()
actualDurationinMillispublic void setActualDurationinMillis(Long actualDurationinMillis)
actualDurationinMillis - the actualDurationinMillis to setactualDurationinMillispublic String getMethodName()
public String getClassName()
Copyright © 2014. All rights reserved.