File tree Expand file tree Collapse file tree 6 files changed +44
-47
lines changed
game-loop/src/test/java/com/iluwatar/gameloop Expand file tree Collapse file tree 6 files changed +44
-47
lines changed Original file line number Diff line number Diff line change 23
23
24
24
package com .iluwatar .gameloop ;
25
25
26
- import org .junit .Test ;
26
+ import org .junit .jupiter . api . Test ;
27
27
28
28
import static org .junit .jupiter .api .Assertions .assertDoesNotThrow ;
29
29
Original file line number Diff line number Diff line change 23
23
24
24
package com .iluwatar .gameloop ;
25
25
26
- import org .junit .After ;
27
- import org .junit .Assert ;
28
- import org .junit .Before ;
29
- import org .junit .Test ;
26
+ import static org .junit .jupiter .api .Assertions .assertEquals ;
27
+
28
+ import org .junit .jupiter .api .Test ;
29
+ import org .junit .jupiter .api .AfterEach ;
30
+ import org .junit .jupiter .api .BeforeEach ;
30
31
31
32
/**
32
33
* FixedStepGameLoop unit test class.
@@ -35,20 +36,20 @@ public class FixedStepGameLoopTest {
35
36
36
37
private FixedStepGameLoop gameLoop ;
37
38
38
- @ Before
39
+ @ BeforeEach
39
40
public void setup () {
40
41
gameLoop = new FixedStepGameLoop ();
41
42
}
42
43
43
- @ After
44
+ @ AfterEach
44
45
public void tearDown () {
45
46
gameLoop = null ;
46
47
}
47
48
48
49
@ Test
49
50
public void testUpdate () {
50
51
gameLoop .update ();
51
- Assert . assertEquals (0.01f , gameLoop .controller .getBulletPosition (), 0 );
52
+ assertEquals (0.01f , gameLoop .controller .getBulletPosition (), 0 );
52
53
}
53
54
54
55
}
Original file line number Diff line number Diff line change 23
23
24
24
package com .iluwatar .gameloop ;
25
25
26
- import org .junit .After ;
27
- import org . junit . Assert ;
28
- import org .junit .Before ;
29
- import org .junit .Test ;
26
+ import static org .junit .jupiter . api . Assertions . assertEquals ;
27
+
28
+ import org .junit .jupiter . api . AfterEach ;
29
+ import org .junit .jupiter . api . BeforeEach ;
30
30
31
31
/**
32
32
* FrameBasedGameLoop unit test class.
@@ -35,19 +35,19 @@ public class FrameBasedGameLoopTest {
35
35
36
36
private FrameBasedGameLoop gameLoop ;
37
37
38
- @ Before
38
+ @ BeforeEach
39
39
public void setup () {
40
40
gameLoop = new FrameBasedGameLoop ();
41
41
}
42
42
43
- @ After
43
+ @ AfterEach
44
44
public void tearDown () {
45
45
gameLoop = null ;
46
46
}
47
47
48
- @ Test
48
+ @ org . junit . jupiter . api . Test
49
49
public void testUpdate () {
50
50
gameLoop .update ();
51
- Assert . assertEquals (0.5f , gameLoop .controller .getBulletPosition (), 0 );
51
+ assertEquals (0.5f , gameLoop .controller .getBulletPosition (), 0 );
52
52
}
53
53
}
Original file line number Diff line number Diff line change 23
23
24
24
package com .iluwatar .gameloop ;
25
25
26
- import org .junit .After ;
27
- import org .junit .Assert ;
28
- import org .junit .Before ;
29
- import org .junit .Test ;
26
+ import org .junit .jupiter .api .Assertions ;
27
+ import org .junit .jupiter .api .AfterEach ;
28
+ import org .junit .jupiter .api .BeforeEach ;
30
29
31
30
public class GameControllerTest {
32
31
33
32
private GameController controller ;
34
33
35
- @ Before
34
+ @ BeforeEach
36
35
public void setup () {
37
36
controller = new GameController ();
38
37
}
39
38
40
- @ After
39
+ @ AfterEach
41
40
public void tearDown () {
42
41
controller = null ;
43
42
}
44
43
45
- @ Test
44
+ @ org . junit . jupiter . api . Test
46
45
public void testMoveBullet () {
47
46
controller .moveBullet (1.5f );
48
- Assert .assertEquals (1.5f , controller .bullet .getPosition (), 0 );
47
+ Assertions .assertEquals (1.5f , controller .bullet .getPosition (), 0 );
49
48
}
50
49
51
- @ Test
50
+ @ org . junit . jupiter . api . Test
52
51
public void testGetBulletPosition () {
53
- Assert .assertEquals (controller .bullet .getPosition (), controller .getBulletPosition (), 0 );
52
+ Assertions .assertEquals (controller .bullet .getPosition (), controller .getBulletPosition (), 0 );
54
53
}
55
54
56
55
}
Original file line number Diff line number Diff line change 23
23
24
24
package com .iluwatar .gameloop ;
25
25
26
- import org .junit .After ;
27
- import org .junit .Assert ;
28
- import org .junit .Before ;
29
- import org .junit .Test ;
26
+ import org .junit .jupiter .api .AfterEach ;
27
+ import org .junit .jupiter .api .Assertions ;
28
+ import org .junit .jupiter .api .BeforeEach ;
30
29
31
30
/**
32
31
* GameLoop unit test class.
@@ -38,34 +37,34 @@ public class GameLoopTest {
38
37
/**
39
38
* Create mock implementation of GameLoop.
40
39
*/
41
- @ Before
40
+ @ BeforeEach
42
41
public void setup () {
43
42
gameLoop = new GameLoop () {
44
43
@ Override
45
44
protected void processGameLoop () {}
46
45
};
47
46
}
48
47
49
- @ After
48
+ @ AfterEach
50
49
public void tearDown () {
51
50
gameLoop = null ;
52
51
}
53
52
54
- @ Test
53
+ @ org . junit . jupiter . api . Test
55
54
public void testRun () {
56
55
gameLoop .run ();
57
- Assert .assertEquals (GameStatus .RUNNING , gameLoop .status );
56
+ Assertions .assertEquals (GameStatus .RUNNING , gameLoop .status );
58
57
}
59
58
60
- @ Test
59
+ @ org . junit . jupiter . api . Test
61
60
public void testStop () {
62
61
gameLoop .stop ();
63
- Assert .assertEquals (GameStatus .STOPPED , gameLoop .status );
62
+ Assertions .assertEquals (GameStatus .STOPPED , gameLoop .status );
64
63
}
65
64
66
- @ Test
65
+ @ org . junit . jupiter . api . Test
67
66
public void testIsGameRunning () {
68
- Assert .assertFalse (gameLoop .isGameRunning ());
67
+ Assertions .assertFalse (gameLoop .isGameRunning ());
69
68
}
70
69
71
70
}
Original file line number Diff line number Diff line change 23
23
24
24
package com .iluwatar .gameloop ;
25
25
26
- import java .lang .reflect .InvocationTargetException ;
27
- import org .junit .After ;
28
- import org .junit .Assert ;
29
- import org .junit .Before ;
30
- import org .junit .Test ;
26
+ import org .junit .jupiter .api .Assertions ;
27
+ import org .junit .jupiter .api .AfterEach ;
28
+ import org .junit .jupiter .api .BeforeEach ;
31
29
32
30
/**
33
31
* VariableStepGameLoop unit test class.
@@ -36,19 +34,19 @@ public class VariableStepGameLoopTest {
36
34
37
35
private VariableStepGameLoop gameLoop ;
38
36
39
- @ Before
37
+ @ BeforeEach
40
38
public void setup () {
41
39
gameLoop = new VariableStepGameLoop ();
42
40
}
43
41
44
- @ After
42
+ @ AfterEach
45
43
public void tearDown () {
46
44
gameLoop = null ;
47
45
}
48
46
49
- @ Test
47
+ @ org . junit . jupiter . api . Test
50
48
public void testUpdate () {
51
49
gameLoop .update (20L );
52
- Assert .assertEquals (0.01f , gameLoop .controller .getBulletPosition (), 0 );
50
+ Assertions .assertEquals (0.01f , gameLoop .controller .getBulletPosition (), 0 );
53
51
}
54
52
}
You can’t perform that action at this time.
0 commit comments