13 Commits
ilona ... dt2

Author SHA1 Message Date
sio
a1d5485025 CorrectionV1 2024-09-26 11:55:44 +02:00
famille Thevenot
09a7279d52 Merge dt
# Conflicts:
#	src/Test.java
#	src/métiers/Commande.java
#	test/métiers/CommandeTest.java
2024-09-25 22:03:48 +02:00
famille Thevenot
c000fb78ee Merge origin/master
# Conflicts:
#	nbproject/project.properties
#	src/métiers/Commande.java
2024-09-25 18:22:52 +02:00
famille Thevenot
b109399da5 Merge origin/master
# Conflicts:
#	nbproject/project.properties
#	src/métiers/Commande.java
2024-09-25 18:18:10 +02:00
famille Thevenot
08e7254265 Merge origin/master
# Conflicts:
#	nbproject/project.properties
#	src/métiers/Commande.java
2024-09-25 18:15:29 +02:00
sio
6bcc94486f mise à jour Morgann 2024-09-19 11:55:10 +02:00
maissane.elmjidi
9e6a9cc867 ajout page maissane 2024-09-19 11:42:33 +02:00
sio
8dc9d9d385 mise à jour pour Commande et testCommande avec Ines et Ilona 2024-09-19 11:38:57 +02:00
e4956996d6 Merge pull request 'test cas 5' (#4) from morgann into master
Reviewed-on: #4
2024-09-19 10:39:59 +02:00
morgann.david
6ed7fb09f2 test cas 5 2024-09-19 10:26:18 +02:00
sio
45a93f086a mise à jour pour Commande et testCommande 2024-09-19 10:11:37 +02:00
sio
0680043384 test cas1 2024-09-12 11:33:20 +02:00
sio
b02b4b8bcf test cas1 2024-09-12 11:25:21 +02:00
12 changed files with 2103 additions and 2096 deletions

View File

@@ -7,8 +7,8 @@
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="MusicAndCoV3" default="default" basedir=".">
<description>Builds, tests, and runs the project MusicAndCoV3.</description>
<project name="MusicAndCo" default="default" basedir=".">
<description>Builds, tests, and runs the project MusicAndCo.</description>
<import file="nbproject/build-impl.xml"/>
<!--
@@ -58,7 +58,7 @@
An example of overriding the target for project execution could look like this:
<target name="run" depends="MusicAndCoV3-impl.jar">
<target name="run" depends="MusicAndCo-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>

View File

@@ -19,7 +19,7 @@ is divided into following sections:
- cleanup
-->
<project xmlns:if="ant:if" xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" xmlns:unless="ant:unless" basedir=".." default="default" name="MusicAndCoV3-impl">
<project xmlns:if="ant:if" xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" xmlns:unless="ant:unless" basedir=".." default="default" name="MusicAndCo-impl">
<fail message="Please build using Ant 1.8.0 or higher.">
<condition>
<not>
@@ -619,7 +619,7 @@ is divided into following sections:
</fileset>
</union>
<taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/>
<testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="MusicAndCoV3" testname="TestNG tests" workingDir="${work.dir}">
<testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="MusicAndCo" testname="TestNG tests" workingDir="${work.dir}">
<xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/>
<propertyset>
<propertyref prefix="test-sys-prop."/>
@@ -716,7 +716,7 @@ is divided into following sections:
<condition else="-testclass @{testClass}" property="test.class.or.method" value="-methods @{testClass}.@{testMethod}">
<isset property="test.method"/>
</condition>
<condition else="-suitename MusicAndCoV3 -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}">
<condition else="-suitename MusicAndCo -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}">
<matches pattern=".*\.xml" string="@{testClass}"/>
</condition>
<delete dir="${build.test.results.dir}" quiet="true"/>
@@ -1057,7 +1057,7 @@ is divided into following sections:
<delete file="${built-jar.properties}" quiet="true"/>
</target>
<target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
<echo level="warn" message="Cycle detected: MusicAndCoV3 was already built"/>
<echo level="warn" message="Cycle detected: MusicAndCo was already built"/>
</target>
<target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
<mkdir dir="${build.dir}"/>
@@ -1728,7 +1728,7 @@ is divided into following sections:
<delete file="${built-clean.properties}" quiet="true"/>
</target>
<target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
<echo level="warn" message="Cycle detected: MusicAndCoV3 was already built"/>
<echo level="warn" message="Cycle detected: MusicAndCo was already built"/>
</target>
<target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
<mkdir dir="${build.dir}"/>

View File

@@ -1,8 +1,8 @@
build.xml.data.CRC32=0e137893
build.xml.script.CRC32=e04698ea
build.xml.stylesheet.CRC32=f85dc8f2@1.111.0.48
build.xml.data.CRC32=ad09f6ef
build.xml.script.CRC32=fbce868f
build.xml.stylesheet.CRC32=f85dc8f2@1.109.0.48
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=0e137893
nbproject/build-impl.xml.script.CRC32=63f48240
nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.111.0.48
nbproject/build-impl.xml.data.CRC32=ad09f6ef
nbproject/build-impl.xml.script.CRC32=4c0de17b
nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.109.0.48

View File

@@ -28,10 +28,10 @@ debug.test.modulepath=\
dist.archive.excludes=
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/MusicAndCoV3.jar
dist.jar=${dist.dir}/MusicAndCo.jar
dist.javadoc.dir=${dist.dir}/javadoc
dist.jlink.dir=${dist.dir}/jlink
dist.jlink.output=${dist.jlink.dir}/MusicAndCoV3
dist.jlink.output=${dist.jlink.dir}/MusicAndCo
excludes=
includes=**
jar.compress=false
@@ -74,8 +74,8 @@ jlink.additionalmodules=
# The jlink additional command line parameters
jlink.additionalparam=
jlink.launcher=true
jlink.launcher.name=MusicAndCoV3
main.class=Test
jlink.launcher.name=MusicAndCo
main.class=MusicAndCo.Test
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false

View File

@@ -3,7 +3,7 @@
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>MusicAndCoV3</name>
<name>MusicAndCo</name>
<source-roots>
<root id="src.dir"/>
</source-roots>

90
src/MusicAndCo/Test.java Normal file
View File

@@ -0,0 +1,90 @@
package MusicAndCo;
import static java.lang.String.format;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import métiers.Commande;
import métiers.Entreprise;
import métiers.Instrument;
import java.util.Scanner;
/**
*
* @author sio
*/
public class Test {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner lectureClavier=new Scanner(System.in);
DateFormat format = new SimpleDateFormat("dd/MM/yyyy");
Date date = new Date();
Entreprise lEntreprise=new Entreprise("MusicAndCo");
Commande laCommande1 = new Commande(1,1,format.format(date));
Commande laCommande2 = new Commande(2,1,format.format(date));
System.out.println("Bienvenue dans ma boutique :" + lEntreprise.getRaisonSociale());
//Première commande
System.out.println("Préparons votre commande :"+laCommande1.toString());
System.out.println("Voici les instruments en stock :");
//ajouter des instruments de l'entreprise à la commande
boolean rep=false;
do {
int ref=menu(lEntreprise); //le menu affiche les instruments
System.out.print("En quelle quantité ?");
int qte=lectureClavier.nextInt();
laCommande1.ajouter(lEntreprise.getLesInstruments().get(ref), qte);
System.out.print("Voulez-vous ajouter un autre instrument à votre commande (oui/non) ?");
String reponse=lectureClavier.next();
rep = "oui".equals(reponse);
}while(rep);
//affecter la commande à l'entreprise si la commande est possible
lEntreprise.ajouterCommande(laCommande1);
System.out.println("Voici votre commande"+lEntreprise.getLesCommandes().get(0));
//--------------------------------------
//créer une autre commande
System.out.println("Voilà l'autre commande :"+laCommande2.toString());
System.out.println("Voici les instruments en stock :");
//ajouter des instruments de l'entreprise à la commande
rep=false;
do {
int ref=menu(lEntreprise);
System.out.print("En quelle quantité ?");
int qte=lectureClavier.nextInt();
laCommande2.ajouter(lEntreprise.getLesInstruments().get(ref), qte);
System.out.print("Voulez-vous ajouter un autre instrument à votre commande (oui/non) ?");
String reponse=lectureClavier.next();
rep = "oui".equals(reponse);
}while(rep);
//affecter la commande à l'entreprise si la commande est possible
lEntreprise.ajouterCommande(laCommande2);
System.out.println("Voici votre commande"+lEntreprise.getLesCommandes().get(1));
//rechercher et afficher une commande
//supprimer une des 2 commandes
//vériffier les stocks après suppression de la commande
}
static int menu(Entreprise uneEnt){
Scanner lectureClavier=new Scanner(System.in);
System.out.println("Choisir un instrument :");
int i=0;
for(Instrument lInst : uneEnt.getLesInstruments()){
i=i+1;
System.out.print(i + "- ");
System.out.println(lInst.toString());
}
System.out.print("Quel instrument voulez-vous ? ");
return lectureClavier.nextInt()-1;
}
}

View File

@@ -1,63 +0,0 @@
import java.util.ArrayList;
import java.util.Scanner;
import métiers.Commande;
import métiers.Entreprise;
import métiers.Instrument;
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
/**
*VERSION SANS PLUSIEURS MENU
* @author ilona.cardot
*/
public class NewClass {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Entreprise lEntreprise=new Entreprise("MusicAndCo");
Commande laCommande = new Commande(1,1,"12/09/2024");
ArrayList<Instrument> lesInstrumentsEnt = lEntreprise.getLesInstruments();
Scanner clavier = new Scanner(System.in);
String choixUtil0="";
lEntreprise.ajouterCommande(laCommande);
while(!choixUtil0.equals("N")){
System.out.println("Commande numero : "+laCommande.getNoCom()+("\t\t Date : "+laCommande.getDateCom()));
System.out.println("----------------------------------------------------------------");
System.out.println("Instruments disponible : ");
for (int i = 0; i < lesInstrumentsEnt.size(); i ++) {
System.out.println("Instrument "+(i+1)+" : "+lesInstrumentsEnt.get(i));//on ajoute 1 à l'index pour ne pas afficher instrument 0
}
System.out.println("Quel instrument souhaitez vous ajouter? (entrez son numero)");
int instrAjoutSaisie = clavier.nextInt()-1; //on supprime 1 pour avoir le bon index
System.out.println("Combien souhaitez vous en ajouter?");
int instrQteAjout = clavier.nextInt();
if (laCommande.ajouter(lesInstrumentsEnt.get(instrAjoutSaisie), instrQteAjout)==true){
System.out.println("Instrument ajoute avec succes");
laCommande.ajouter(lesInstrumentsEnt.get(instrAjoutSaisie), instrQteAjout);
} else {
System.out.println("Ajout impossible, instrument non existant ou quantite choisie superieur à la quantite disponible");
}
System.out.println("----------------------------------------------------------------");
System.out.println("Souhaitez vous ajouter des instruments à la commande? (O/N)");
choixUtil0 = clavier.next();
}
//finalisation de la commande
System.out.println("---------------------------Contenu de la commande numero "+laCommande.getNoCom()+"------------------------------");
System.out.println(laCommande.getLesLignes());
System.out.println("Validez vous la commande?(O/N)");
String choixUtil2 = clavier.next();
if (choixUtil0.equals("O")){
System.out.println("Commande validée");
lEntreprise.ajouterCommande(laCommande);
}else {
System.out.println("Commande annulée");
}
System.out.println("----------------------------------------------------------------");
}
}

View File

@@ -1,89 +0,0 @@
import java.util.ArrayList;
import métiers.*;
import java.util.Scanner;
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template
*/
/**
*
* @author sio
*/
public class Test {
Entreprise lEntreprise=new Entreprise("MusicAndCo");
Commande laCommande = new Commande(1,1,"12/09/2024");
ArrayList<Instrument> lesInstrumentsEnt = lEntreprise.getLesInstruments();
Scanner clavier = new Scanner(System.in);
/**
* Création d'une nouvelle commande et ajout si validée
*/
public Test(){
}
public void nouvelleCommande(){
String choixUtil0="";
lEntreprise.ajouterCommande(laCommande);
while(!choixUtil0.equals("N")){
System.out.println("Commande numero : "+laCommande.getNoCom()+("\t\t Date : "+laCommande.getDateCom()));
System.out.println("----------------------------------------------------------------");
System.out.println("Instruments disponible : ");
for (int i = 0; i < lesInstrumentsEnt.size(); i ++) {
System.out.println("Instrument "+(i+1)+" : "+lesInstrumentsEnt.get(i));//on ajoute 1 à l'index pour ne pas afficher instrument 0
}
System.out.println("Quel instrument souhaitez vous ajouter? (entrez son numero)");
int instrAjoutSaisie = clavier.nextInt()-1; //on supprime 1 pour avoir le bon index
System.out.println("Combien souhaitez vous en ajouter?");
int instrQteAjout = clavier.nextInt();
if (laCommande.ajouter(lesInstrumentsEnt.get(instrAjoutSaisie), instrQteAjout)==true){
System.out.println("Instrument ajoute avec succes");
laCommande.ajouter(lesInstrumentsEnt.get(instrAjoutSaisie), instrQteAjout);
} else {
System.out.println("Ajout impossible, instrument non existant ou quantite choisie superieur à la quantite disponible");
}
System.out.println("----------------------------------------------------------------");
System.out.println("Souhaitez vous ajouter des instruments à la commande? (O/N)");
choixUtil0 = clavier.next();
}
//finalisation de la commande
System.out.println("---------------------------Contenu de la commande numero "+laCommande.getNoCom()+"------------------------------");
System.out.println(laCommande.getLesLignes());
System.out.println("Validez vous la commande?(O/N)");
String choixUtil2 = clavier.next();
if (choixUtil0.equals("O")){
System.out.println("Commande validée");
lEntreprise.ajouterCommande(laCommande);
}else {
System.out.println("Commande annulée");
}
System.out.println("----------------------------------------------------------------");
}
public void commandesExistantes(){
}
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Test test1;
test1 = new Test();
int choixUtil=0;
while(choixUtil!=3){
System.out.println("Que souhaitez vous faire?\n\t1 : Créer une nouvelle commande \n\t 2: Annuler une commande existante\n\t 3: Fermer l'application");
switch(choixUtil){
case 1 :
test1.nouvelleCommande();
break;
/*case 2 :
test1.commandesExistantes;
break;*/
case 3 :
break;
}
}
}

View File

@@ -36,18 +36,44 @@ private final HashMap<Instrument, Integer> lesLignes = new HashMap<>();
* @return true si l'ajout est bon
*/
public boolean ajouter(Instrument unInstrument, int qte){
//il faut gérer l'ajout d'un instrument existant dans la commande, ce sera une mise à jour de la ligne
//il faut empêcher l'ajout d'une ligne avec une quantité à 0
//bien s'assurer que le stock est suffisant
boolean ajoutOK;
boolean ajoutOK=false;
if(qte==0) System.out.println("Vous ne pouvez pas commander une quantité 0");
else{
//ajout d'un instrument existant dans la commande, ce sera une mise à jour de la ligne
if (lesLignes.containsKey(unInstrument))//l'instrument existe
{
//récupération de la quantité en stock
int oldQte=unInstrument.getQteStock();
//réaffectation dans le stock de la quantité commandée
int qteStock=oldQte+ this.getLesLignes().get(unInstrument);
unInstrument.setQteStock(qteStock);
//suppression ligne commande
lesLignes.remove(unInstrument);
//nouvel ajout
this.ajouter(unInstrument,qte);
System.out.println("Ligne de commande préexistante mise à jour");
}
else //nouvel instrument
{
//on s'assure qu'il y a assez de stock pour la commande
int qteDisponible = unInstrument.getQteStock();
if (qteDisponible<qte){
ajoutOK = false;
System.out.println("Ajout impossible, quantité en stock insuffisante");
}else {
ajoutOK = true;
lesLignes.put(unInstrument,qte);
//màj qté stock pour déduire la qté commandée
unInstrument.setQteStock(qteDisponible-qte);
System.out.println("Instrument ajouté à la commande");
}
}
}
return ajoutOK;
}
/**
@@ -57,14 +83,18 @@ private final HashMap<Instrument, Integer> lesLignes = new HashMap<>();
*/
public boolean supprimer(Instrument unInstrument){
//lesLignes.remove(unInstrument);
boolean suppOK = false;
boolean suppOK;
if (lesLignes.containsKey(unInstrument) == true){
suppOK = true;
int qteCommande = lesLignes.get(unInstrument);
//récupération de la quantité en stock
int oldQte=unInstrument.getQteStock();
//réaffectation dans le stock de la quantité commandée
int qteStock=oldQte+ this.getLesLignes().get(unInstrument);
unInstrument.setQteStock(qteStock);
//suppression ligne commande
lesLignes.remove(unInstrument);
int qteDisponible = unInstrument.getQteStock();
unInstrument.setQteStock(qteDisponible+qteCommande);
} else {
suppOK = false;
}
return suppOK;
}
@@ -123,7 +153,7 @@ private final HashMap<Instrument, Integer> lesLignes = new HashMap<>();
@Override
public String toString() {
return "numero de commande : " + noCom + "\t \t date de la commadne : " + dateCom + "\n contenu de la commande : " + lesLignes + '}';
return " "+noCom+" du vendeur " + noVendeur + ", du " + dateCom + ", contient " + lesLignes + '}';
}

View File

@@ -28,6 +28,22 @@ public class Entreprise {
lesInstruments.add(instr3);
}
public ArrayList<Commande> getLesCommandes() {
return lesCommandes;
}
public void setLesCommandes(ArrayList<Commande> lesCommandes) {
this.lesCommandes = lesCommandes;
}
public ArrayList<Instrument> getLesInstruments() {
return lesInstruments;
}
public void setLesInstruments(ArrayList<Instrument> lesInstruments) {
this.lesInstruments = lesInstruments;
}
public String getRaisonSociale() {
return raisonSociale;
}
@@ -63,23 +79,4 @@ public class Entreprise {
}
return uneCommande;
}
public ArrayList<Commande> getLesCommandes() {
return lesCommandes;
}
public ArrayList<Instrument> getLesInstruments() {
return lesInstruments;
}
public void setLesCommandes(ArrayList<Commande> lesCommandes) {
this.lesCommandes = lesCommandes;
}
public void setLesInstruments(ArrayList<Instrument> lesInstruments) {
this.lesInstruments = lesInstruments;
}
}

View File

@@ -25,7 +25,7 @@ public class Instrument {
@Override
public String toString() {
return "reference : " + ref + "\t designation : " + designation + "\t quantite en stock : " + qteStock + "\t prix : " + prix + '}';
return designation + ", Stock=" + qteStock + ", prix=" + prix ;
}
public void setRef(int ref) {

View File

@@ -5,9 +5,7 @@
package métiers;
import java.util.HashMap;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
@@ -18,19 +16,21 @@ public class CommandeTest {
public CommandeTest() {
}
@Before
public void setUp() {
}
/**
* Test of ajouter method, of class Commande.
*/
@Test
public void testAjouter() {
Instrument instr1=new Instrument(1,"Piano",10, 8300f);
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");
System.out.println("ajouter");
//cas 0
boolean ajoutRes= laCommande.ajouter(instr1, 2);
boolean ajoutAttendu = true;
System.out.println("cas0 : cas normal, ajout une ligne de commande");
@@ -42,50 +42,92 @@ public class CommandeTest {
int qteAttendu=2;
assertEquals("Test0 quantite",qteRes, qteAttendu);
//cas 1
System.out.println("Cas1 : ajout autre ligne de commande");
laCommande.ajouter(instr2, 6);
int tailleR=laCommande.getLesLignes().size();
int tailleAttendue=2;
assertEquals("Test1 taille",tailleAttendue,tailleR);
/* System.out.println("Cas2 : màj quantité commandée d'une ligne existante");
//Cas2
System.out.println("Cas2 : màj quantité commandée d'une ligne existante");
laCommande.ajouter(instr2, 5);
stockRes=instr2.getQteStock();
stockAttendu=4;
assertEquals("test2 stock",stockAttendu,stockRes );
/*qteRes=laCommande.getLesLignes().get(instr2);
qteRes=laCommande.getLesLignes().get(instr2);
qteAttendu=5;
assertEquals("Test2 quantite", qteAttendu,qteRes);
/*INES*/
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*/
System.out.println("Cas4 : ajout nouvelle ligne avec quantité 0");
System.out.println("Cas4 : ajout nouvelle ligne avec quantité 0");
boolean AjouterObtenu=laCommande.ajouter(instr3, 0);
boolean AjouterA= false;
assertEquals("Test4 ajout 0 instr3",AjouterA,AjouterObtenu);
int lignes=laCommande.getLesLignes().size();
int nbLigneAttendu = 2;
assertEquals("Test4 taille",nbLigneAttendu,lignes);
qteRes=laCommande.getLesLignes().get(instr3);
qteAttendu=0;
assertEquals("Test4 quantite", qteAttendu,qteRes);
/*MORGANN*/
System.out.println("Cas5 : mise à 0 quantité commandée d'une ligne existante");
System.out.println("Cas6 : màj d'une ligne existante avec qté>stock");*/
laCommande.ajouter(instr2, 0);
stockRes=instr2.getQteStock();
stockAttendu=9;
assertEquals("test5 stock",stockAttendu,stockRes );
tailleR=laCommande.getLesLignes().size();
tailleAttendue=2;
assertEquals("Test1 taille",tailleAttendue,tailleR);
/*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");
boolean resultatMethode = laCommande.ajouter(instr1, 12);
boolean resultatMethodeAttendu=false;
assertEquals("test6 mise à jour",resultatMethodeAttendu,resultatMethode);
stockRes=instr1.getQteStock();
stockAttendu=2;
assertEquals("test6 stock",stockAttendu,stockRes );
}
private void assertEquals(String test1_taille, int tailleAttendue, int tailleR) {
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
}
private void assertEquals(String la_méthode_ajouter_retourne_false, boolean testResultExpected, boolean test) {
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
}
/**
* Test of supprimer method, of class Commande.
@Test
public void testSupprimer() {
Instrument instr1 = new Instrument(1,"Piano",10,8300f);
Instrument instr2 = new Instrument(2,"Violon",9,105f);
Commande laCommande2 = new Commande(1,1,"12/09/2024");
laCommande2.ajouter(instr1,2);
boolean expectedResult=false;
boolean expectedResult2=true;
int stockAttendu=10;
System.out.println("Test de la méthode supprimer");
boolean test = laCommande2.supprimer(instr2);
boolean test2 = laCommande2.supprimer(instr1);
int test3 = instr1.getQteStock();
assertEquals("suppression impossible : ",expectedResult,test);
assertEquals("suppression possible : ",expectedResult2,test2);
assertEquals("Quantité d'instr1 en stock",stockAttendu,test3);
}
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.");
}*/
}