Calculator { public Double calculateBi(BiOperatorModes newMode, Double num) { if (mode == BiOperatorModes.normal) { num2 = 0.0; num1 = num; mode = newMode; return NaN; } else { num2 = num; num1 = calculateBiImpl(); mode = newMode; return num1; } }  Double calculateBi(BiOperatorModes newMode, Double num); Double calculateEqual(Double num); Double reset(); Double calculateMono(MonoOperatorModes newMode, Double num);  }
@Test void calculateBiNormalTest() { Calculator calculator = new Calculator(); calculator.calculateBi(Calculator.BiOperatorModes.normal, 2.0); Assertions.assertEquals(NaN, calculator.calculateBi(Calculator.BiOperatorModes.normal, 3.0)); }
@Test void calculateBiAddTest() { Calculator calculator = new Calculator(); calculator.calculateBi(Calculator.BiOperatorModes.add, 3.0); Assertions.assertEquals(5.5, calculator.calculateBi(Calculator.BiOperatorModes.normal, 2.5)); }
@Test void calculateBiMinusTest() { Calculator calculator = new Calculator(); calculator.calculateBi(Calculator.BiOperatorModes.minus, 3.1415); Assertions.assertEquals(2.0415, calculator.calculateBi(Calculator.BiOperatorModes.normal, 1.1)); }
@Test void calculateBiMultiplyTest() { Calculator calculator = new Calculator(); calculator.calculateBi(Calculator.BiOperatorModes.multiply, 3.2); Assertions.assertEquals(6.4, calculator.calculateBi(Calculator.BiOperatorModes.normal, 2.0)); }
@Test void calculateBiDivideTest() { Calculator calculator = new Calculator(); calculator.calculateBi(Calculator.BiOperatorModes.divide, 6.4); Assertions.assertEquals(3.2, calculator.calculateBi(Calculator.BiOperatorModes.normal, 2.0)); }