The below code produces a NullPointerException when I run it. Which is weird because shouldn't the setup()
method be ran before the tests?
If I instantiate the AirJourney class within the test method the JUnit test passes without any problems. What am I missing?
private AirJourney journey;
@Before
public void setup()
{
journey = new AirJourney(4, 800, "A", "B");
}
@Test
public void testCorrectCostIsProduced()
{
assertEquals(32000, journey.calculateCostOfJourney());
}