test de la classe commande cas 4

This commit is contained in:
ines.benalia 2024-09-19 11:56:51 +02:00
parent 9977862a27
commit 8fa260fd23

View File

@ -85,20 +85,28 @@ public class CommandeTest {
}
/**
* Test of supprimer method, of class Commande.
@Test
public void testSupprimer() {
System.out.println("supprimer");
Instrument unInstrument = null;
Commande instance = null;
boolean expResult = false;
boolean result = instance.supprimer(unInstrument);
assertEquals("test supprimer",expResult, result);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}*/
//instanciation
Instrument instr1=new Instrument(1,"Piano",10, 8300f);
Instrument instr2=new Instrument(2,"Violon",9, 105f);
Commande laCommande = new Commande(1,1,"12/09/2024");
laCommande.ajouter(instr1, 2);
boolean expectedResult=false;
boolean expectedResult2=true;
// test
boolean test= laCommande.supprimer(instr2);
boolean test2= laCommande.supprimer(instr1);
assertEquals("suppression impossible",expectedResult,test);
assertEquals("suppression possible ",test2,expectedResult2 );
System.out.println("Nombre de ligne dans le dictionnaire: "+laCommande.getLesLignes().size());
}
}