Solved

Consider the Partial JUnit Test Below, Designed to Test a Class

Question 85

Multiple Choice

Consider the partial JUnit test below, designed to test a class that keeps a count: @Test public void twoIncrements()
{
Counter ctr = new Counter(10) ;
Ctr) increment() ;
Ctr) increment() ;
// Put test line here
}
Which line will test that the resulting value is 12?


A) Assert.assertEquals(12, ctr.getValue() ) ;
B) Assert.assertEquals(ctr.getValue() ) ;
C) System.out.println(12 == ctr.getValue() ) ;
D) if (12 == ctr.getValue() ) { System.out.println("Passed") ; } else { System.out.println("Failed") ;}

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions