Table of Contents
Foreword |
Preface |
Why Unit Testing |
Who This Book Is For |
What You Need |
How to Use This Book |
Code and Online Resources |
Acknowledgments |
1. | Building Your First JUnit Test |
Reasons to Write a Unit Test |
Learning JUnit Basics: Our First Passing Test |
Arrange, Act, and Assert Your Way to a Test |
Is the Test Really Testing Anything? |
After |
2. | Getting Real with JUnit |
Understanding What We’re Testing: The Profile Class |
Determining What Tests We Can Write |
Covering One Path |
Tackling a Second Test |
Initializing Tests with @Before Methods |
How Ya Feelin’ Now? |
After |
3. | Digging Deeper into JUnit Assertions |
Assertions in JUnit |
Three Schools for Expecting Exceptions |
After |
4. | Organizing Your Tests |
Keeping Tests Consistent with AAA |
Testing Behavior Versus ... |
Get Pragmatic Unit Testing in Java 8 with JUnit now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.