@Test public void testRetirerTrop() throws Exception { int montant = 100; int montantRetrait = 150; CompteBancaire instance = new CompteBancaire("toto", montant); assertThrows( CompteException.class, () -> { instance.retirer(montantRetrait); }, "Le retrait de " + montantRetrait + " doit lancer une CompteException"); } @Test public void testRetirer() throws Exception { int montant = 100; int montantRetrait = 50; CompteBancaire instance = new CompteBancaire("toto", montant); instance.retirer(montantRetrait); assertEquals(montant - montantRetrait, instance.getSolde(), "Mauvais calcul du solde après un retrait"); } @Test public void testViderCompte() throws Exception { int montant = 100; CompteBancaire instance = new CompteBancaire("toto", montant); assertDoesNotThrow( () -> { instance.retirer(montant); }, "Le retrait de " + montant + " ne doit pas lancer une exception"); }