DEV Community

Max Angelo Dapitilla Perin
Max Angelo Dapitilla Perin

Posted on

Answer: Java/ JUnit - AssertTrue vs AssertFalse

assertTrue will fail if the second parameter evaluates to false (in other words, it ensures that the value is true). assertFalse does the opposite.

assertTrue("This will succeed.", true);
assertTrue("This will fail!", false);

assertFalse("This will succeed.", false);
assertFalse("This will fail!", true);

As with many other things, the best way to becomeโ€ฆ

Top comments (0)