I want to write the both test cases whether positive scenario and negative scenario.
My sample code is,
/**
*
*/
public void testgetAsnAccuracyInstanceType() throws Exception
{
String METHOD_NAME = "testgetAsnAccuracyInstanceType";
log.entering(CLASS_NAME, METHOD_NAME);
//Rating Element "1" ASN Accuracy
populateForTestMethodValues("1");
populateWeekOfList();
List<WeeklyDeliveryInstanceTypeQO> asnAccuracyInstanceTypeList = weeklyDlvyInstancesDashboardReportForm.getAsnAccuracyInstanceType();
assertTrue("testgetASNAccuracyRatingElement is Not Empty: ", asnAccuracyInstanceTypeList.size() > 0);
log.exiting(CLASS_NAME, METHOD_NAME);
}
This line
assertTrue("testgetASNAccuracyRatingElement is Not Empty: ",
asnAccuracyInstanceTypeList.size() > 0);
is strictly equivalent to:
assertFalse("testgetASNAccuracyRatingElement is Not Empty: ",
asnAccuracyInstanceTypeList.isEmpty());
(if that was what you were asking)