November 2024
Intermediate to advanced
300 pages
7h 12m
English
You’ve learned the most important features of JUnit in the prior four chapters of this book, enough to survive but not thrive. Truly succeeding with your unit testing journey will involve gaining proficiency with your primary tool, JUnit. In this and the next couple of chapters, you’ll explore JUnit in significant detail. First, you’ll focus on JUnit’s means of verification—its assertion library.
Assertions (or asserts) in JUnit are static method calls that you drop into your tests. Each assertion is an opportunity to verify that some condition holds true. If an asserted condition does not hold true, the test stops executing right there and JUnit reports a test failure.
To abort the test, JUnit throws ...
Read now
Unlock full access