-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCalcTest.java
More file actions
52 lines (40 loc) · 1014 Bytes
/
CalcTest.java
File metadata and controls
52 lines (40 loc) · 1014 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import static org.junit.Assert.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.Before;
import org.junit.After;
import org.junit.BeforeClass;
import org.junit.Test;
public class CalcTest {
/*
* You have to import the Before and After things
* import org.junit.Before;
* import org.junit.After;
*/
@BeforeClass
public static void greet() {
System.out.println("Before Everything");
}
@Before
public void beforeMethod() {
System.out.println("Before each test");
}
@After
public void afterMethod() {
System.out.println("After each test");
}
@Test
public void test1() {
assertEquals(0, Calculate.multiply(0, 1));
System.out.println("Test 1");
}
@Test
public void test2() {
assertEquals(1, Calculate.multiply(1, 1));
System.out.println("Test 2");
}
@Test
public void test3() {
assertEquals(2.0, Calculate.multiply(2.0, 1.0), 0.0001);
System.out.println("Test 3");
}
}