Learning JUnit Basics: Our First Passing Test
For our first example, we’ll write tests against a small class named ScoreCollection. Its goal is to return the mean (average) for a collection of scoreable objects (things that answer with a score).
For this first example, you’ll see Eclipse screenshots. The screenshots are here to guide you through setting up and using JUnit for the first time. After this chapter, you won’t see screenshots and you won’t need them.
If you’re not using Eclipse, good news: your JUnit tests will look the same whether you use Eclipse, IntelliJ IDEA, NetBeans, or some other development environment. How you set up your project to use JUnit will differ, and the way JUnit looks and feels will differ a bit from IDE to ...