inesV2 #10

Open
ines.benalia wants to merge 3 commits from inesV2 into master

View File

@ -29,6 +29,7 @@ public class CommandeTest {
public void testAjouter() { public void testAjouter() {
Instrument instr1=new Instrument(1,"Piano",10, 8300f); Instrument instr1=new Instrument(1,"Piano",10, 8300f);
Instrument instr2=new Instrument(2,"Violon",9, 105f); Instrument instr2=new Instrument(2,"Violon",9, 105f);
Instrument instr3=new Instrument(3,"piano",8, 105f);
Commande laCommande = new Commande(1,1,"12/09/2024"); Commande laCommande = new Commande(1,1,"12/09/2024");
System.out.println("ajouter"); System.out.println("ajouter");
//cas 0 //cas 0
@ -63,28 +64,49 @@ public class CommandeTest {
/*INES*/ /*INES*/
System.out.println("Cas3 : ajout nouvelle ligne avec quantité > stock"); System.out.println("Cas3 : ajout nouvelle ligne avec quantité > stock");
boolean test= laCommande.ajouter(instr3, 12);
stockRes=instr3.getQteStock();
stockAttendu=8;
boolean testResultExpected=false;
assertEquals("test3 stock",stockAttendu,stockRes );
assertEquals("La méthode ajouter retourne false",testResultExpected,test );
System.out.println("Nombre de ligne dans le dictionnaire: "+laCommande.getLesLignes().size());
System.out.println("Résultat de la méthode ajouter: " + test);
/*MAISSANE*/ /*MAISSANE*/
System.out.println("Cas4 : ajout nouvelle ligne avec quantité 0"); System.out.println("Cas4 : ajout nouvelle ligne avec quantité 0");
/*MORGANN*/ /*MORGANN*/
System.out.println("Cas5 : mise à 0 quantité commandée d'une ligne existante"); System.out.println("Cas5 : mise à 0 quantité commandée d'une ligne existante");
/*INES*/ /*ILONA*/
System.out.println("Cas6 : màj d'une ligne existante avec qté>stock"); System.out.println("Cas6 : màj d'une ligne existante avec qté>stock");
} }
/**
* Test of supprimer method, of class Commande.
@Test @Test
public void testSupprimer() { public void testSupprimer() {
System.out.println("supprimer"); //instanciation
Instrument unInstrument = null;
Commande instance = null; Instrument instr1=new Instrument(1,"Piano",10, 8300f);
boolean expResult = false; Instrument instr2=new Instrument(2,"Violon",9, 105f);
boolean result = instance.supprimer(unInstrument); Commande laCommande = new Commande(1,1,"12/09/2024");
assertEquals("test supprimer",expResult, result); laCommande.ajouter(instr1, 2);
// TODO review the generated test code and remove the default call to fail. boolean expectedResult=false;
fail("The test case is a prototype."); 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());
}
} }