1
1
package com .fishercoder .firstthousand ;
2
2
3
3
import com .fishercoder .solutions .firstthousand ._735 ;
4
- import org .junit .BeforeClass ;
5
- import org .junit .Test ;
4
+ import org .junit .jupiter . api . BeforeEach ;
5
+ import org .junit .jupiter . api . Test ;
6
6
7
- import static org .junit .Assert .assertArrayEquals ;
7
+ import static org .junit .jupiter . api . Assertions .assertArrayEquals ;
8
8
9
9
public class _735Test {
10
10
private static _735 .Solution1 solution1 ;
11
11
private static _735 .Solution2 solution2 ;
12
12
private static _735 .Solution3 solution3 ;
13
+ private static _735 .Solution4 solution4 ;
13
14
private static int [] asteroids ;
14
15
private static int [] expected ;
15
16
16
- @ BeforeClass
17
- public static void setup () {
17
+ @ BeforeEach
18
+ public void setup () {
18
19
solution1 = new _735 .Solution1 ();
19
20
solution2 = new _735 .Solution2 ();
20
21
solution3 = new _735 .Solution3 ();
22
+ solution4 = new _735 .Solution4 ();
21
23
}
22
24
23
25
@ Test
@@ -27,34 +29,43 @@ public void test1() {
27
29
assertArrayEquals (expected , solution1 .asteroidCollision (asteroids ));
28
30
assertArrayEquals (expected , solution2 .asteroidCollision (asteroids ));
29
31
assertArrayEquals (expected , solution3 .asteroidCollision (asteroids ));
32
+ assertArrayEquals (expected , solution4 .asteroidCollision (asteroids ));
30
33
}
31
34
32
35
@ Test
33
36
public void test2 () {
34
37
asteroids = new int []{8 , -8 };
35
38
asteroids = solution1 .asteroidCollision (asteroids );
36
- assertArrayEquals (new int []{}, asteroids );
39
+ expected = new int []{};
40
+ assertArrayEquals (expected , asteroids );
41
+ assertArrayEquals (expected , solution4 .asteroidCollision (asteroids ));
37
42
}
38
43
39
44
@ Test
40
45
public void test3 () {
41
46
asteroids = new int []{10 , 2 , -5 };
42
47
asteroids = solution1 .asteroidCollision (asteroids );
43
- assertArrayEquals (new int []{10 }, asteroids );
48
+ expected = new int []{10 };
49
+ assertArrayEquals (expected , asteroids );
50
+ assertArrayEquals (expected , solution4 .asteroidCollision (asteroids ));
44
51
}
45
52
46
53
@ Test
47
54
public void test4 () {
48
55
asteroids = new int []{-2 , 1 , 2 , -2 };
49
56
asteroids = solution1 .asteroidCollision (asteroids );
50
- assertArrayEquals (new int []{-2 , 1 }, asteroids );
57
+ expected = new int []{-2 , 1 };
58
+ assertArrayEquals (expected , asteroids );
59
+ assertArrayEquals (expected , solution4 .asteroidCollision (asteroids ));
51
60
}
52
61
53
62
@ Test
54
63
public void test5 () {
55
64
asteroids = new int []{-2 , -2 , -2 , 1 };
56
65
asteroids = solution1 .asteroidCollision (asteroids );
57
- assertArrayEquals (new int []{-2 , -2 , -2 , 1 }, asteroids );
66
+ expected = new int []{-2 , -2 , -2 , 1 };
67
+ assertArrayEquals (expected , asteroids );
68
+ assertArrayEquals (expected , solution4 .asteroidCollision (asteroids ));
58
69
}
59
70
60
71
@ Test
0 commit comments