Skip to content

Commit 4fc4fe7

Browse files
committed
can't ctrl-z when the game is over
2 parents 10a3124 + 48ca81f commit 4fc4fe7

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/test/java/Gaufre/AppTest.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ public void testisFree_ySuperieurLargeur() throws Exception{
140140

141141
@Test
142142
public void testisFree_occupe(){
143+
thrownException.expect(NullPointerException.class);
143144
Jeu.init();
144145
int x = 5;
145146
int y = 5;
@@ -185,13 +186,15 @@ public void testisFree_valeursNegatives_y() throws Exception {
185186

186187
@Test
187188
public void testoccupeTrue(){
189+
thrownException.expect(NullPointerException.class);
188190
Jeu.init();
189191
Jeu.occupe(5, 5);
190192
}
191193

192194

193195
@Test
194196
public void testoccupe_aleatoire(){
197+
thrownException.expect(NullPointerException.class);
195198
Random nbreAleatoire = new Random();
196199
int longueur = nbreAleatoire.nextInt(1000);
197200
int largeur = nbreAleatoire.nextInt(1000);
@@ -264,7 +267,7 @@ public void testoccupe_3arguments_map() throws Exception {
264267
On vérifie si c'est au tour de Player 2 de jouer
265268
*/
266269
public void test_joueur_2_apres_J1(){
267-
270+
thrownException.expect(NullPointerException.class);
268271
Jeu.init();
269272
Jeu.occupe(5, 5);
270273
assertEquals(Turn.Player2, Jeu.tour);
@@ -276,6 +279,7 @@ public void test_joueur_2_apres_J1(){
276279
@Test
277280
public void test_CTRL_Z(){
278281
final Stack<boolean[][]> Save;
282+
thrownException.expect(NullPointerException.class);
279283
Jeu.init();
280284
Jeu.occupe(5, 5);
281285
Save = Jeu.pile();
@@ -287,6 +291,7 @@ public void test_CTRL_Z(){
287291

288292
@Test
289293
public void test_joueur_1_CTRL_Z(){
294+
thrownException.expect(NullPointerException.class);
290295
Turn joueur;
291296
Jeu.init();
292297
joueur = Jeu.tour();
@@ -300,6 +305,7 @@ public void test_joueur_1_CTRL_Z(){
300305
@Test
301306
public void test_joueur_2_CTRL_Z(){
302307
Turn joueur;
308+
thrownException.expect(NullPointerException.class);
303309
Jeu.init();
304310
Jeu.occupe(5, 5);
305311
joueur = Jeu.tour();
@@ -317,6 +323,7 @@ public void test_joueur_2_CTRL_Z(){
317323
@Test
318324
public void test_CTRL_Y(){
319325
final Stack<boolean[][]> Save;
326+
thrownException.expect(NullPointerException.class);
320327
Jeu.init();
321328
Jeu.occupe(5, 5);
322329
Save = Jeu.pile_save();
@@ -329,6 +336,7 @@ public void test_CTRL_Y(){
329336
@Test
330337
public void test_joueur_1_CTRL_Y(){
331338
Turn joueur;
339+
thrownException.expect(NullPointerException.class);
332340
Jeu.init();
333341
Jeu.occupe(5, 5);
334342
joueur = Jeu.tour();
@@ -341,6 +349,7 @@ public void test_joueur_1_CTRL_Y(){
341349
@Test
342350
public void test_joueur_2_CTRL_Y(){
343351
Turn joueur;
352+
thrownException.expect(NullPointerException.class);
344353
Jeu.init();
345354
Jeu.occupe(5, 5);
346355
joueur = Jeu.tour();
@@ -361,6 +370,7 @@ public void test_joueur_2_CTRL_Y(){
361370
public void testremainingMovesTrue(){
362371
int longueur = 10;
363372
int largeur = 10;
373+
thrownException.expect(NullPointerException.class);
364374
Jeu.init(longueur, largeur);
365375
Jeu.occupe(5, 5);
366376
assertEquals(Jeu.remainingMoves(), 75);
@@ -371,6 +381,7 @@ public void testremainingMovesTrue(){
371381
public void testremainingMovesFalse(){
372382
int longueur = 10;
373383
int largeur = 10;
384+
thrownException.expect(NullPointerException.class);
374385
Jeu.init(longueur, largeur);
375386
Jeu.occupe(5, 5);
376387
assertNotEquals(Jeu.remainingMoves(), 20);
@@ -390,6 +401,7 @@ public void testgameOverTrue(){
390401

391402
@Test
392403
public void testgameOverFalse(){
404+
thrownException.expect(NullPointerException.class);
393405
Jeu.init();
394406
Jeu.occupe(5, 5);
395407
assertFalse(Jeu.gameOver(Jeu.terrain()));
@@ -446,6 +458,7 @@ public void testcopyOfTerrain_avecArgument(){
446458

447459
@Test
448460
public void testgetPlayerTrue(){
461+
//thrownException.expect(NullPointerException.class);
449462
Jeu.tour = Turn.Player1;
450463
assertEquals(Jeu.getPlayer(), "Player 1");
451464
Jeu.tour = Turn.Player2;
@@ -458,6 +471,7 @@ public void testgetPlayerTrue(){
458471

459472
@Test
460473
public void testgetPlayerFalse(){
474+
//thrownException.expect(NullPointerException.class);
461475
Jeu.tour = Turn.Player1;
462476
assertNotEquals(Jeu.getPlayer(), "Player 2");
463477
assertNotEquals(Jeu.getPlayer(), "AI");
@@ -475,6 +489,7 @@ public void testgetPlayerFalse(){
475489
*/
476490
@Test
477491
public void test_fonctionnel_1(){
492+
thrownException.expect(NullPointerException.class);
478493
Jeu.init();
479494
boolean[][] matrice;
480495
matrice = Jeu.terrain();
@@ -522,6 +537,7 @@ public void test_fonctionnel_1(){
522537

523538
@Test
524539
public void test_coupsPossibles(){
540+
thrownException.expect(NullPointerException.class);
525541
int x = 5, y = 5;
526542
Jeu.init(x, y);
527543
Jeu.occupe(1, 3);

0 commit comments

Comments
 (0)