22
22
import processing .net .Client ;
23
23
import processing .net .Server ;
24
24
import project_16x16 .SideScroller ;
25
- import project_16x16 .multiplayer .Multiplayer ;
26
25
27
26
@ ExtendWith (MockitoExtension .class )
28
- public class MultiplayerTest {
27
+ class MultiplayerTest {
29
28
30
29
@ Mock
31
30
private SideScroller player ;
32
31
33
32
@ Test
34
- public void callingConstructorAsServer_ok () {
33
+ void callingConstructorAsServer_ok () {
35
34
ConnectException ce = null ;
36
35
try {
37
- Multiplayer multiplayer = new Multiplayer (player , false );
36
+ new Multiplayer (player , false );
38
37
}
39
38
catch (ConnectException e ) {
40
39
ce = e ;
@@ -44,10 +43,10 @@ public void callingConstructorAsServer_ok() {
44
43
}
45
44
46
45
@ Test
47
- public void callingConstructorAsClient_ok () {
46
+ void callingConstructorAsClient_ok () {
48
47
ConnectException ce = null ;
49
48
try {
50
- Multiplayer multiplayer = new Multiplayer (player , true );
49
+ new Multiplayer (player , true );
51
50
}
52
51
catch (ConnectException e ) {
53
52
ce = e ;
@@ -57,13 +56,13 @@ public void callingConstructorAsClient_ok() {
57
56
}
58
57
59
58
@ Test
60
- public void callingConstructorAsServer_raisesException () {
59
+ void callingConstructorAsServer_raisesException () {
61
60
ConnectException ce = null ;
62
61
try (MockedConstruction <Server > mocked = mockConstruction (Server .class , (mock , context ) -> {
63
62
when (mock .active ()).thenReturn (false );
64
63
})) {
65
64
try {
66
- Multiplayer multiplayer = new Multiplayer (player , true );
65
+ new Multiplayer (player , true );
67
66
}
68
67
catch (ConnectException e ) {
69
68
ce = e ;
@@ -74,13 +73,13 @@ public void callingConstructorAsServer_raisesException() {
74
73
}
75
74
76
75
@ Test
77
- public void callingConstructorAsClient_raisesException () {
76
+ void callingConstructorAsClient_raisesException () {
78
77
ConnectException ce = null ;
79
78
try (MockedConstruction <Client > mocked = mockConstruction (Client .class , (mock , context ) -> {
80
79
when (mock .active ()).thenReturn (false );
81
80
})) {
82
81
try {
83
- Multiplayer multiplayer = new Multiplayer (player , false );
82
+ new Multiplayer (player , false );
84
83
}
85
84
catch (ConnectException e ) {
86
85
ce = e ;
@@ -91,7 +90,7 @@ public void callingConstructorAsClient_raisesException() {
91
90
}
92
91
93
92
@ Test
94
- public void callingReadDataAsServerWithNoClient_returnsNullData () {
93
+ void callingReadDataAsServerWithNoClient_returnsNullData () {
95
94
ConnectException ce = null ;
96
95
JSONObject data = null ;
97
96
try (MockedConstruction <Server > mocked = mockConstruction (Server .class , (mock , context ) -> {
@@ -112,7 +111,7 @@ public void callingReadDataAsServerWithNoClient_returnsNullData() {
112
111
}
113
112
114
113
@ Test
115
- public void callingReadDataAsServerWithClient_returnsData () {
114
+ void callingReadDataAsServerWithClient_returnsData () {
116
115
ConnectException ce = null ;
117
116
JSONObject data = null ;
118
117
@@ -138,7 +137,7 @@ public void callingReadDataAsServerWithClient_returnsData() {
138
137
}
139
138
140
139
@ Test
141
- public void callingReadDataAsClientWithNoAvailableData_returnsNullData () {
140
+ void callingReadDataAsClientWithNoAvailableData_returnsNullData () {
142
141
ConnectException ce = null ;
143
142
JSONObject data = null ;
144
143
try (MockedConstruction <Client > client = mockConstruction (Client .class , (mock , context ) -> {
@@ -159,7 +158,7 @@ public void callingReadDataAsClientWithNoAvailableData_returnsNullData() {
159
158
}
160
159
161
160
@ Test
162
- public void callingReadDataAsClient_returnsData () {
161
+ void callingReadDataAsClient_returnsData () {
163
162
ConnectException ce = null ;
164
163
JSONObject data = null ;
165
164
try (MockedConstruction <Client > client = mockConstruction (Client .class , (mock , context ) -> {
@@ -182,7 +181,7 @@ public void callingReadDataAsClient_returnsData() {
182
181
}
183
182
184
183
@ Test
185
- public void callingWriteDataAsServer () {
184
+ void callingWriteDataAsServer () {
186
185
ConnectException ce = null ;
187
186
try (MockedConstruction <Server > mocked = mockConstruction (Server .class , (mock , context ) -> {
188
187
when (mock .active ()).thenReturn (true );
@@ -203,7 +202,7 @@ public void callingWriteDataAsServer() {
203
202
}
204
203
205
204
@ Test
206
- public void callingWriteDataAsClient () {
205
+ void callingWriteDataAsClient () {
207
206
ConnectException ce = null ;
208
207
try (MockedConstruction <Client > mocked = mockConstruction (Client .class , (mock , context ) -> {
209
208
when (mock .active ()).thenReturn (true );
@@ -224,7 +223,7 @@ public void callingWriteDataAsClient() {
224
223
}
225
224
226
225
@ Test
227
- public void callingWriteDataAsClientNotActive_doNotWrites () {
226
+ void callingWriteDataAsClientNotActive_doNotWrites () {
228
227
ConnectException ce = null ;
229
228
try (MockedConstruction <Client > mocked = mockConstruction (Client .class , (mock , context ) -> {
230
229
when (mock .active ()).thenReturn (true );
@@ -246,7 +245,7 @@ public void callingWriteDataAsClientNotActive_doNotWrites() {
246
245
}
247
246
248
247
@ Test
249
- public void callingExitAsServer () {
248
+ void callingExitAsServer () {
250
249
ConnectException ce = null ;
251
250
try (MockedConstruction <Server > mocked = mockConstruction (Server .class , (mock , context ) -> {
252
251
when (mock .active ()).thenReturn (true );
@@ -267,7 +266,7 @@ public void callingExitAsServer() {
267
266
}
268
267
269
268
@ Test
270
- public void callingExitAsClient () {
269
+ void callingExitAsClient () {
271
270
ConnectException ce = null ;
272
271
try (MockedConstruction <Client > mocked = mockConstruction (Client .class , (mock , context ) -> {
273
272
when (mock .active ()).thenReturn (true );
0 commit comments