test cas1
This commit is contained in:
parent
8f366b4003
commit
b02b4b8bcf
@ -48,7 +48,8 @@ javac.source=21
|
|||||||
javac.target=21
|
javac.target=21
|
||||||
javac.test.classpath=\
|
javac.test.classpath=\
|
||||||
${javac.classpath}:\
|
${javac.classpath}:\
|
||||||
${build.classes.dir}
|
${build.classes.dir}:\
|
||||||
|
${libs.junit_5.classpath}
|
||||||
javac.test.modulepath=\
|
javac.test.modulepath=\
|
||||||
${javac.modulepath}
|
${javac.modulepath}
|
||||||
javac.test.processorpath=\
|
javac.test.processorpath=\
|
||||||
|
@ -25,8 +25,10 @@ public class Test {
|
|||||||
Commande laCommande = new Commande(1,1,"12/09/2024");
|
Commande laCommande = new Commande(1,1,"12/09/2024");
|
||||||
lEntreprise.ajouterCommande(laCommande);
|
lEntreprise.ajouterCommande(laCommande);
|
||||||
|
|
||||||
//Ajouter à la commande une ligne de 2 instr1
|
//Test Cas0-Ajouter à la commande une ligne de 2 instr1
|
||||||
laCommande.ajouter(instr1, 2);
|
System.out.println("Résultat de l'ajout de 2 instr1 à la commande :" + laCommande.ajouter(instr1, 2) );
|
||||||
|
System.out.println("Nouveau stock de instr1 : "+instr1.getQteStock());
|
||||||
|
System.out.println("Quantité de la ligne de commande de instr1 :"+laCommande.getLesLignes().get(instr1));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
211
test/métiers/CommandeTest.java
Normal file
211
test/métiers/CommandeTest.java
Normal file
@ -0,0 +1,211 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/UnitTests/JUnit5TestClass.java to edit this template
|
||||||
|
*/
|
||||||
|
package métiers;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import org.junit.jupiter.api.AfterAll;
|
||||||
|
import org.junit.jupiter.api.AfterEach;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author sio
|
||||||
|
*/
|
||||||
|
public class CommandeTest {
|
||||||
|
|
||||||
|
public CommandeTest() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@BeforeAll
|
||||||
|
public static void setUpClass() throws Exception {
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterAll
|
||||||
|
public static void tearDownClass() throws Exception {
|
||||||
|
}
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
public void setUp() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterEach
|
||||||
|
public void tearDown() throws Exception {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test of ajouter method, of class Commande.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testAjouter() {
|
||||||
|
System.out.println("ajouter");
|
||||||
|
Commande instance = null;
|
||||||
|
Instrument instr1=new Instrument(1,"Piano",10, 8300f);
|
||||||
|
Instrument instr2=new Instrument(2,"Violon",9, 105f);
|
||||||
|
Instrument instr3=new Instrument(3,"Guitare",8, 575f);
|
||||||
|
//Cas0
|
||||||
|
instance.ajouter(instr1, 2);
|
||||||
|
// Cas1
|
||||||
|
|
||||||
|
instance.ajouter(instr2, 6);
|
||||||
|
|
||||||
|
int nbLignesAttendues=2;
|
||||||
|
int nbLignes=instance.getLesLignes().size();
|
||||||
|
assertEquals("Cas01 : test nb lignes ",nbLignesAttendues,nbLignes);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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(expResult, result);
|
||||||
|
// TODO review the generated test code and remove the default call to fail.
|
||||||
|
fail("The test case is a prototype.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test of getNoCom method, of class Commande.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testGetNoCom() {
|
||||||
|
System.out.println("getNoCom");
|
||||||
|
Commande instance = null;
|
||||||
|
int expResult = 0;
|
||||||
|
int result = instance.getNoCom();
|
||||||
|
assertEquals(expResult, result);
|
||||||
|
// TODO review the generated test code and remove the default call to fail.
|
||||||
|
fail("The test case is a prototype.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test of getNoVendeur method, of class Commande.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testGetNoVendeur() {
|
||||||
|
System.out.println("getNoVendeur");
|
||||||
|
Commande instance = null;
|
||||||
|
int expResult = 0;
|
||||||
|
int result = instance.getNoVendeur();
|
||||||
|
assertEquals(expResult, result);
|
||||||
|
// TODO review the generated test code and remove the default call to fail.
|
||||||
|
fail("The test case is a prototype.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test of getDateCom method, of class Commande.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testGetDateCom() {
|
||||||
|
System.out.println("getDateCom");
|
||||||
|
Commande instance = null;
|
||||||
|
String expResult = "";
|
||||||
|
String result = instance.getDateCom();
|
||||||
|
assertEquals(expResult, result);
|
||||||
|
// TODO review the generated test code and remove the default call to fail.
|
||||||
|
fail("The test case is a prototype.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test of getLesLignes method, of class Commande.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testGetLesLignes() {
|
||||||
|
System.out.println("getLesLignes");
|
||||||
|
Commande instance = null;
|
||||||
|
HashMap<Instrument, Integer> expResult = null;
|
||||||
|
HashMap<Instrument, Integer> result = instance.getLesLignes();
|
||||||
|
assertEquals(expResult, result);
|
||||||
|
// TODO review the generated test code and remove the default call to fail.
|
||||||
|
fail("The test case is a prototype.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test of setNoCom method, of class Commande.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testSetNoCom() {
|
||||||
|
System.out.println("setNoCom");
|
||||||
|
int noCom = 0;
|
||||||
|
Commande instance = null;
|
||||||
|
instance.setNoCom(noCom);
|
||||||
|
// TODO review the generated test code and remove the default call to fail.
|
||||||
|
fail("The test case is a prototype.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test of setNoVendeur method, of class Commande.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testSetNoVendeur() {
|
||||||
|
System.out.println("setNoVendeur");
|
||||||
|
int noVendeur = 0;
|
||||||
|
Commande instance = null;
|
||||||
|
instance.setNoVendeur(noVendeur);
|
||||||
|
// TODO review the generated test code and remove the default call to fail.
|
||||||
|
fail("The test case is a prototype.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test of setDateCom method, of class Commande.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testSetDateCom() {
|
||||||
|
System.out.println("setDateCom");
|
||||||
|
String dateCom = "";
|
||||||
|
Commande instance = null;
|
||||||
|
instance.setDateCom(dateCom);
|
||||||
|
// TODO review the generated test code and remove the default call to fail.
|
||||||
|
fail("The test case is a prototype.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test of equals method, of class Commande.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testEquals() {
|
||||||
|
System.out.println("equals");
|
||||||
|
Object obj = null;
|
||||||
|
Commande instance = null;
|
||||||
|
boolean expResult = false;
|
||||||
|
boolean result = instance.equals(obj);
|
||||||
|
assertEquals(expResult, result);
|
||||||
|
// TODO review the generated test code and remove the default call to fail.
|
||||||
|
fail("The test case is a prototype.");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void assertEquals(String test_nb_lignes, int nbLignesAttendues, int i) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
}
|
||||||
|
|
||||||
|
private void assertEquals(boolean expResult, boolean result) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
}
|
||||||
|
|
||||||
|
private void assertEquals(int expResult, int result) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
}
|
||||||
|
|
||||||
|
private void assertEquals(String expResult, String result) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
}
|
||||||
|
|
||||||
|
private void assertEquals(HashMap<Instrument, Integer> expResult, HashMap<Instrument, Integer> result) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user