màj pour version initialeV2

This commit is contained in:
2025-09-24 18:14:21 +02:00
parent 62092bb78b
commit d92fa2649e
12 changed files with 351 additions and 118 deletions

View File

@@ -0,0 +1,69 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/UnitTests/JUnit4TestClass.java to edit this template
*/
package com.mycompany.bibliotheque;
import com.mycompany.bibliotheque.Métier.Bibliotheque;
import com.mycompany.bibliotheque.Métier.Livre;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author dthev
*/
public class BibliothequeTest {
public BibliothequeTest() {
}
@Before
public void setUp() {
}
/**
* Test of addLivre method, of class Bibliotheque.
*/
@Test
public void testAddLivre() {
System.out.println("addLivre");
Livre b = null;
Bibliotheque instance = new Bibliotheque();
boolean expResult = false;
boolean result = instance.addLivre(b);
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 getLesLivres method, of class Bibliotheque.
*/
@Test
public void testGetLesLivres() {
System.out.println("getLesLivres");
Bibliotheque instance = new Bibliotheque();
List<Livre> expResult = null;
List<Livre> result = instance.getLesLivres();
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 setLesLivres method, of class Bibliotheque.
*/
@Test
public void testSetLesLivres() {
System.out.println("setLesLivres");
List<Livre> lesLivres = null;
Bibliotheque instance = new Bibliotheque();
instance.setLesLivres(lesLivres);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
}

View File

@@ -4,49 +4,20 @@
*/
package com.mycompany.bibliotheque;
import com.mycompany.bibliotheque.Métier.Livre;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
public class LivreTest {
private Livre livre;
@Before
public void setUp() {
// Création d'un livre avant chaque test
livre = new Livre("Java Basics", 20.0);
}
@Test
public void testGetTitre() {
assertEquals("pb titre","Java Basic", livre.getTitre());
}
public void testCreationLivre() {
Livre b = new Livre("1984", "George Orwell", "1234567890123", false);
@Test
public void testGetPrixHT() {
// Vérification du prix HT arrondi à 3 décimales
}
@Test
public void testIsEmprunte() {
// Par défaut, le livre n'est pas emprunté
assertFalse(livre.isEmprunte());
}
@Test
public void testSetEmprunte() {
livre.setEmprunte(true);
assertTrue(livre.isEmprunte());
livre.setEmprunte(false);
assertFalse(livre.isEmprunte());
}
@Test
public void testGetPrixTTC() {
// Calcul du prix TTC avec TVA 5.5% arrondi à 2 décimales
}
assertNotNull(b);
assertEquals("1984", b.getTitre());
assertEquals("George Orwel", b.getAuteur()); // corrigé
assertEquals("1234567890123", b.getIsbn());
assertFalse(b.isEmprunte()); // si la méthode existe
}
}

View File

@@ -0,0 +1,81 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/UnitTests/JUnit4TestClass.java to edit this template
*/
package com.mycompany.bibliotheque;
import com.mycompany.bibliotheque.Contrôle.LivreValide;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author dthev
*/
public class LivreValideTest {
public LivreValideTest() {
}
@Before
public void setUp() {
}
/**
* Test of isValidIsbn method, of class LivreValide.
*/
@Test
public void testIsValidIsbn() {
System.out.println("isValidIsbn");
String isbn = "";
boolean expResult = false;
boolean result = LivreValide.isValidIsbn(isbn);
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 isValidTitre method, of class LivreValide.
*/
@Test
public void testIsValidTitre() {
System.out.println("isValidTitre");
String Titre = "";
boolean expResult = false;
boolean result = LivreValide.isValidTitre(Titre);
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 isValidAuteur method, of class LivreValide.
*/
@Test
public void testIsValidAuteur() {
System.out.println("isValidAuteur");
String auteur = "";
boolean expResult = false;
boolean result = LivreValide.isValidAuteur(auteur);
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 isLongueurTitreValid method, of class LivreValide.
*/
@Test
public void testIsLongueurTitreValid() {
System.out.println("isLongueurTitreValid");
String titre = "";
boolean expResult = false;
boolean result = LivreValide.isLongueurTitreValid(titre);
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
}

View File

@@ -4,6 +4,8 @@
*/
package com.mycompany.bibliotheque;
import com.mycompany.bibliotheque.Métier.Utilisateur;
import com.mycompany.bibliotheque.Métier.Livre;
import java.util.List;
import org.junit.Before;
import org.junit.Test;