6 Commits

12 changed files with 31 additions and 114 deletions

1
.gitignore vendored
View File

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

View File

@@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>bibliotheque</artifactId>
<artifactId>GestionBibliotheque</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
@@ -19,6 +19,7 @@
<version>4.13.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<!-- Configuration du build -->
@@ -28,9 +29,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
<version>2.22.2</version>
</plugin>
</plugins>
</build>
<name>GestionBibliotheque</name>
</project>

View File

@@ -32,10 +32,4 @@ public class LivreValide {
// TODO: implémenter la validation
return false;
}
// 5. Titre : non null et au moins 2 caractères
public static boolean isContenuTitreValide(String titre) {
// TODO: implémenter la validation
return false;
}
}

View File

@@ -1,21 +1,19 @@
/*
* 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
*/
package com.mycompany.bibliotheque;
/**
* Classe principale
* @author dthev
*/
import com.mycompany.bibliotheque.Métier.Bibliotheque;
import com.mycompany.bibliotheque.Métier.Emprunt;
import com.mycompany.bibliotheque.Métier.Utilisateur;
import com.mycompany.bibliotheque.Métier.Livre;
import java.util.Scanner;
/**
*
* @author dthev
*/
public class GestionBibliotheque {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
@@ -27,10 +25,10 @@ public class GestionBibliotheque {
System.out.println("Bienvenue dans la bibliothèque !");
while (choix!=4){
System.out.println("1. Afficher un livre");
System.out.println("2. Ajouter un livre");
System.out.println("3. Ajouter un livre");
System.out.println("3. Afficher les livres");
System.out.println("4. Quitter");
System.out.print("Merci de faire votre choix : ");
System.out.println("Votre choix : ");
choix = sc.nextInt();
switch (choix) {
case 1 :

View File

@@ -8,7 +8,7 @@ import java.util.ArrayList;
import java.util.List;
/**
* Classe métier
*
* @author dthev
*/
public class Bibliotheque {
@@ -17,7 +17,6 @@ public class Bibliotheque {
// 5. ISBN doit être unique
public boolean addLivre(Livre b) {
//ajoute b si valide et si n'existe pas - à écrire
lesLivres.add(b);
return false;
}

View File

@@ -4,16 +4,11 @@
*/
package com.mycompany.bibliotheque.Métier;
import com.mycompany.bibliotheque.Métier.Utilisateur;
import com.mycompany.bibliotheque.Métier.Livre;
/**
*
* @author dthev
*/
public class Emprunt {
// TODO: logique métier d'emprunt
public static boolean effectuerEmprunt(Utilisateur u, Livre l) {
if (l.isEmprunte()) {

View File

@@ -5,8 +5,9 @@
package com.mycompany.bibliotheque.Métier;
/**
*
* Classe métier qui gère les livres
* @author dthev
*
*/
public class Livre {

View File

@@ -4,15 +4,14 @@
*/
package com.mycompany.bibliotheque.Métier;
/**
*
* @author dthev
*/
import com.mycompany.bibliotheque.Métier.Livre;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author dthev
*/
public class Utilisateur {
private String nom;
private List<Livre> emprunts;

View File

@@ -2,9 +2,8 @@
* 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;
package com.mycompany.bibliotheque.Contrôle;
import com.mycompany.bibliotheque.Contrôle.LivreValide;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;

View File

@@ -2,10 +2,8 @@
* 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;
package com.mycompany.bibliotheque.Métier;
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;

View File

@@ -2,13 +2,16 @@
* 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;
package com.mycompany.bibliotheque.Métier;
import com.mycompany.bibliotheque.Métier.Livre;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author dthev
*/
public class LivreTest {
@Test
public void testCreationLivre() {
@@ -16,7 +19,7 @@ public void testCreationLivre() {
assertNotNull(b);
assertEquals("1984", b.getTitre());
assertEquals("George Orwel", b.getAuteur()); // corrigé
assertEquals("George Orwell", b.getAuteur()); // corrigé
assertEquals("1234567890123", b.getIsbn());
assertFalse(b.isEmprunte()); // si la méthode existe
}

View File

@@ -1,70 +0,0 @@
/*
* 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.Utilisateur;
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 UtilisateurTest {
public UtilisateurTest() {
}
@Before
public void setUp() {
}
/**
* Test of getNom method, of class Utilisateur.
*/
@Test
public void testGetNom() {
System.out.println("getNom");
Utilisateur instance = null;
String expResult = "";
String result = instance.getNom();
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 getEmprunts method, of class Utilisateur.
*/
@Test
public void testGetEmprunts() {
System.out.println("getEmprunts");
Utilisateur instance = null;
List<Livre> expResult = null;
List<Livre> result = instance.getEmprunts();
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 emprunterLivre method, of class Utilisateur.
*/
@Test
public void testEmprunterLivre() {
System.out.println("emprunterLivre");
Livre livre = null;
Utilisateur instance = null;
boolean expResult = false;
boolean result = instance.emprunterLivre(livre);
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
}