package allumettes; import org.junit.*; import static org.junit.Assert.assertEquals; public class TestPartie { @Test(expected = ConfigurationException.class) public void TestConstructeurNegatif() { new Partie(-1); } @Test(expected = ConfigurationException.class) public void TestConstructeurNul() { new Partie(0); } @Test public void TestConstructeurPositif() { new Partie(1); } @Test(expected = CoupInvalideException.class) public void TestRetirerNegatif() throws CoupInvalideException { new Partie(1).retirer(-1); } @Test(expected = CoupInvalideException.class) public void TestRetirerNul() throws CoupInvalideException { new Partie(1).retirer(0); } @Test public void TestRetirerPositif() throws CoupInvalideException { Partie game = new Partie(20); game.retirer(1); assertEquals(game.getNombreAllumettes(), 19); game.retirer(2); assertEquals(game.getNombreAllumettes(), 17); game.retirer(3); assertEquals(game.getNombreAllumettes(), 14); game.retirer(4); assertEquals(game.getNombreAllumettes(), 10); game.retirer(10); assertEquals(game.getNombreAllumettes(), 0); } }