In the given “old-school” test for the generation of an exception:
@Test public void VerboseExceptionTest() { rodCutter.setPrices(prices); try { rodCutter.maxProfit(0); fail("Expected exception for zero length"); } catch(RodCutterException ex) { assertTrue(true); } }
- The name of the method is capitalized
- The purpose of
assertTrue(true)
is unclear. Is there just for documentation? One would write a statement likeassertTrue(someComplexBooleanExpression)
butassertTrue(true)
does nothing.