-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathCalculatorTest.java
More file actions
31 lines (24 loc) · 924 Bytes
/
CalculatorTest.java
File metadata and controls
31 lines (24 loc) · 924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import org.junit.Test;
import static org.junit.Assert.*;
public class CalculatorTest {
@Test
public void testProduct() {
// Create an instance of the Calculator class
Calculator product = new Calculator();
// Call the multiply method on the Calculator instance
// and store the result in the 'prod' variable
int prod = product.multiply(2,4);
// Check if the result is equal to 8 using the assertEquals method
assertEquals(8,prod);
}
@Test
public void testAdd() {
// Create an instance of the Calculator class
Calculator calculator = new Calculator();
// Call the add method on the Calculator instance
// and store the result in the 'result' variable
int result = calculator.add(2, 3);
// Check if the result is equal to 5 using the assertEquals method
assertEquals(5, result);
}
}