fonction retourLivres créé
This commit is contained in:
@@ -4,6 +4,10 @@
|
|||||||
*/
|
*/
|
||||||
package com.mycompany.bibliotheque.Controle;
|
package com.mycompany.bibliotheque.Controle;
|
||||||
|
|
||||||
|
import com.mycompany.bibliotheque.Metier.Livre;
|
||||||
|
import com.mycompany.bibliotheque.Metier.Utilisateur;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Classe de contrôle de la classe Livre
|
* Classe de contrôle de la classe Livre
|
||||||
* @author dthev
|
* @author dthev
|
||||||
@@ -78,4 +82,19 @@ public class LivreValide {
|
|||||||
|
|
||||||
return contenuValide;
|
return contenuValide;
|
||||||
}
|
}
|
||||||
|
public static boolean retourLivre(Utilisateur user){
|
||||||
|
Scanner sc = new Scanner(System.in);
|
||||||
|
int i=0;
|
||||||
|
for(Livre unLivre:user.getEmprunts()){
|
||||||
|
i++;
|
||||||
|
System.out.println(i+". "+unLivre.getTitre());
|
||||||
|
}
|
||||||
|
System.out.print("Merci de faire votre choix : ");
|
||||||
|
int choix = sc.nextInt();
|
||||||
|
Livre leLivre = user.getEmprunts().get(choix-1);
|
||||||
|
|
||||||
|
leLivre.setEmprunte(false);
|
||||||
|
user.getEmprunts().remove(leLivre);
|
||||||
|
return leLivre.isEmprunte();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -155,7 +155,7 @@ public class LivreValideTest {
|
|||||||
System.out.println("Titre invalide. Aucune valeur n'a été saisie\n");
|
System.out.println("Titre invalide. Aucune valeur n'a été saisie\n");
|
||||||
|
|
||||||
//test 2 : titre inférieur à 200
|
//test 2 : titre inférieur à 200
|
||||||
System.out.println("Test avec aucune valeur saisie");
|
System.out.println("Test avec valeur saisie OK");
|
||||||
String titre2 = "Hadal Blacksite bestiary";
|
String titre2 = "Hadal Blacksite bestiary";
|
||||||
boolean expResult2 = true;
|
boolean expResult2 = true;
|
||||||
boolean result2 = LivreValide.isLongueurTitreValid(titre2);
|
boolean result2 = LivreValide.isLongueurTitreValid(titre2);
|
||||||
@@ -171,13 +171,7 @@ public class LivreValideTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testIsContenuTitreValid() {
|
|
||||||
System.out.println("isLongueurTitreValid");
|
|
||||||
String titre = "";
|
|
||||||
boolean expResult = false;
|
|
||||||
boolean result = LivreValide.isLongueurTitreValid(titre);
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Test of isTitreValid method, of class LivreValide.
|
* Test of isTitreValid method, of class LivreValide.
|
||||||
* @author Steve
|
* @author Steve
|
||||||
|
Reference in New Issue
Block a user