Complete the code to declare the test method with the correct annotation.
@[1]
public void testAddition() {
// test code here
}The @Test annotation marks a method as a test method in JUnit.
Complete the code to create an instance of Calculator in the Arrange step.
public void testAddition() {
Calculator calculator = new [1]();
int result = calculator.add(2, 3);
// assertions
}In the Arrange step, we create an object of the class we want to test, here Calculator.
Fix the error in the assertion statement to check the expected result.
assertEquals([1], result);The expected value should be the number 5, not the variable or string.
Fill both blanks to complete the Arrange and Act steps correctly.
Calculator calculator = new [1](); int result = calculator.[2](4, 6);
We create a Calculator object and call its add method.
Fill all three blanks to complete the Arrange, Act, and Assert steps in the test method.
@Test
public void testMultiply() {
Calculator calculator = new [1]();
int result = calculator.[2](3, 7);
assertEquals([3], result);
}The test creates a Calculator, calls multiply with 3 and 7, and asserts the result is 21.
