9 Commits

Author SHA1 Message Date
09cf3836c2 longueur titre : tests opérationnels 2025-10-03 09:22:44 +02:00
19d2e618c3 test livre ok 2025-09-26 11:23:46 +02:00
sio
22bce1d53b màj javadoc 2025-09-26 09:45:12 +02:00
6ec5d152eb Merge pull request 'màj LivreValidTest.java' (#3) from Prof into developpement
Reviewed-on: #3
2025-09-26 08:58:04 +02:00
sio
f1571ced27 màj LivreValidTest.java 2025-09-26 08:56:57 +02:00
ca3338fe1a Merge pull request 'Prof' (#2) from Prof into developpement
Reviewed-on: #2
2025-09-26 08:38:36 +02:00
sio
0eac6c497d nouveau message choix 2025-09-26 08:36:50 +02:00
sio
980fc1cc7c nouveau message choix 2025-09-26 08:35:00 +02:00
bec1ca9f04 Merge pull request 'master' (#1) from master into developpement
Reviewed-on: #1
2025-09-24 21:35:51 +02:00
5 changed files with 49 additions and 7 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/target/

View File

@@ -11,7 +11,7 @@ package com.mycompany.bibliotheque.Contrôle;
public class LivreValide { public class LivreValide {
// 1. ISBN : exactement 13 chiffres // 1. ISBN : exactement 13 chiffres
public static boolean isValidIsbn(String isbn) { public static boolean isValidIsbn(String isbn) {
// TODO: implémenter la validation // TODO Emile: implémenter la validation
return false; return false;
} }
@@ -29,13 +29,17 @@ public class LivreValide {
// 4. Titre : longueur maximale 200 caractères // 4. Titre : longueur maximale 200 caractères
public static boolean isLongueurTitreValid(String titre) { public static boolean isLongueurTitreValid(String titre) {
// TODO: implémenter la validation // TODO Morgann: implémenter la validation
return false; boolean valide = false;
if(titre.length()<=200 && titre != "" && titre != null){
valide = true;
}
return valide;
} }
// 5. Titre : non null et au moins 2 caractères // 5. Titre : non null et au moins 2 caractères
public static boolean isContenuTitreValide(String titre) { public static boolean isContenuTitreValide(String titre) {
// TODO: implémenter la validation // TODO Steve: implémenter la validation
return false; return false;
} }
} }

View File

@@ -30,7 +30,7 @@ public class GestionBibliotheque {
System.out.println("2. Ajouter un livre"); System.out.println("2. Ajouter un livre");
System.out.println("3. Afficher les livres"); System.out.println("3. Afficher les livres");
System.out.println("4. Quitter"); System.out.println("4. Quitter");
System.out.println("Votre choix : "); System.out.print("Merci de faire votre choix : ");
choix = sc.nextInt(); choix = sc.nextInt();
switch (choix) { switch (choix) {
case 1 : case 1 :

View File

@@ -16,7 +16,7 @@ public void testCreationLivre() {
assertNotNull(b); assertNotNull(b);
assertEquals("1984", b.getTitre()); assertEquals("1984", b.getTitre());
assertEquals("George Orwel", b.getAuteur()); // corrigé assertEquals("George Orwell", b.getAuteur()); // corrigé
assertEquals("1234567890123", b.getIsbn()); assertEquals("1234567890123", b.getIsbn());
assertFalse(b.isEmprunte()); // si la méthode existe assertFalse(b.isEmprunte()); // si la méthode existe
} }

View File

@@ -24,6 +24,7 @@ public class LivreValideTest {
/** /**
* Test of isValidIsbn method, of class LivreValide. * Test of isValidIsbn method, of class LivreValide.
* @author Emile
*/ */
@Test @Test
public void testIsValidIsbn() { public void testIsValidIsbn() {
@@ -38,6 +39,7 @@ public class LivreValideTest {
/** /**
* Test of isValidTitre method, of class LivreValide. * Test of isValidTitre method, of class LivreValide.
* @author Salomé/Emile
*/ */
@Test @Test
public void testIsValidTitre() { public void testIsValidTitre() {
@@ -52,6 +54,7 @@ public class LivreValideTest {
/** /**
* Test of isValidAuteur method, of class LivreValide. * Test of isValidAuteur method, of class LivreValide.
* @author Medhi/Steve
*/ */
@Test @Test
public void testIsValidAuteur() { public void testIsValidAuteur() {
@@ -66,13 +69,47 @@ public class LivreValideTest {
/** /**
* Test of isLongueurTitreValid method, of class LivreValide. * Test of isLongueurTitreValid method, of class LivreValide.
* @author Morgann
*/ */
@Test @Test
public void testIsLongueurTitreValid() { public void testIsLongueurTitreValid() {
System.out.println("isLongueurTitreValid"); System.out.println("isLongueurTitreValid");
//test 1 : aucune valeur saisie
System.out.println("Test avec aucune valeur saisie");
String titre1 = "";
boolean expResult1 = false;
boolean result1 = LivreValide.isLongueurTitreValid(titre1);
assertEquals(expResult1, result1);
System.out.println("Titre invalide. Aucune valeur n'a été saisie\n");
//test 2 : titre inférieur à 200
System.out.println("Test avec aucune valeur saisie");
String titre2 = "Hadal Blacksite bestiary";
boolean expResult2 = true;
boolean result2 = LivreValide.isLongueurTitreValid(titre2);
assertEquals(expResult2, result2);
System.out.println("Titre valide. Le titre a moins de 200 caractères\n");
System.out.println("Test avec un titre avec plus de 200 caractères");
String titre3 = "YOU !! You could've had everything you ever wanted... Everything I ever wanted... And you still went out of your way to take everything I had left in the process. You entitled brat. You expect me to sit idly by and keep smiling, As if nothing ever happened? Oh, I'm smiling alright... GRINNING ear to ear. Don't even start with that 'following orders' schlock. You knew what you were doing all too well. Sure took your sweet time. Enjoyed every last second of it? Good. *Chuckles* EXCELLENT, even! I'll merely return the favor. And you bet, I'll be enjoying, every last moment, of THIS!!! THE BEST PART!? I get to do this, over, and over, again. You'll come back, I'll know, and I'll be waiting... You have no one to blame but yourself. You're in a hell of your own making... And you're NEVER GETTING OUT!!! *grrgh* WHAT!!! WHAT IS IT THIS TIME!?!?";
boolean expResult3 = false;
boolean result3 = LivreValide.isLongueurTitreValid(titre3);
assertEquals(expResult3, result3);
System.out.println("Titre invalide. Titre trop long\n");
}
/**
* Test of isTitreValid method, of class LivreValide.
* @author Steve
*/
@Test
public void testIsContenuTitreValide() {
System.out.println("isTitreValid");
String titre = ""; String titre = "";
boolean expResult = false; boolean expResult = false;
boolean result = LivreValide.isLongueurTitreValid(titre); boolean result = LivreValide.isContenuTitreValide(titre);
assertEquals(expResult, result); assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail. // TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype."); fail("The test case is a prototype.");