We need to create a Calculator
object that we will test. To do this, we will:
setUp
method.We initialise via the setUp
method since the setUp
method will be run before each test method. This ensures that each test method will have a brand new object to test with and help to ensure that the tests are independent of each other.
Add the field:
private Calculator calc;
Initialise the field in the setUp
method:
calc = new Calculator();