-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
67d4c18
commit f65a238
Showing
3 changed files
with
78 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package azul.vue; | ||
|
||
public class AfficherMessage { | ||
|
||
public void affiche(String emetteur, String msg) { | ||
System.out.println(emetteur+">"+msg); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package azul; | ||
|
||
import azul.joueur.Joueur; | ||
import azul.moteurdejeu.Azul; | ||
import azul.vue.AfficherMessage; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.mockito.InOrder; | ||
import org.mockito.Mock; | ||
import org.mockito.junit.jupiter.MockitoExtension; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
import static org.mockito.Mockito.inOrder; | ||
|
||
@ExtendWith(MockitoExtension.class) | ||
class PartiesTest { | ||
@Mock | ||
AfficherMessage vue; | ||
|
||
@Mock | ||
Azul p; | ||
|
||
@Mock | ||
Joueur j1, j2, j3; | ||
|
||
Parties parties; | ||
|
||
@BeforeEach | ||
void setUp(){ | ||
parties = new Parties(vue, p, j1, j2, j3); | ||
} | ||
|
||
@Test | ||
void lancer() { | ||
InOrder ordre = inOrder(p); | ||
int nbParties = 5; | ||
parties.lancer(nbParties); | ||
for(int i = 0; i < nbParties; i++){ | ||
ordre.verify(p).initialisation(); | ||
ordre.verify(p).jouer(); | ||
} | ||
|
||
nbParties = 500; | ||
parties.lancer(nbParties); | ||
for(int i = 0; i < nbParties; i++){ | ||
ordre.verify(p).initialisation(); | ||
ordre.verify(p).jouer(); | ||
} | ||
} | ||
} |