forked from pierront/mylibrary-template
book respect convention de nomage
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package fr.iut_fbleau.but3.dev62.mylibrary.book;
|
||||
|
||||
public class book {
|
||||
public class Book {
|
||||
private String isbn;
|
||||
private String title;
|
||||
private String author;
|
||||
@@ -10,7 +10,7 @@ public class book {
|
||||
private String quantity;
|
||||
private String language;
|
||||
|
||||
public book(String isbn, String title, String author, String publisher,
|
||||
public Book(String isbn, String title, String author, String publisher,
|
||||
String publicationDate, String price, String quantity, String language) {
|
||||
this.isbn = isbn;
|
||||
this.title = title;
|
@@ -1,10 +1,10 @@
|
||||
package fr.iut_fbleau.but3.dev62.mylibrary.book;
|
||||
import java.util.*;
|
||||
|
||||
public class bookManagement {
|
||||
private final Map<String, book> books = new LinkedHashMap<>();
|
||||
public class BookManagement {
|
||||
private final Map<String, Book> books = new LinkedHashMap<>();
|
||||
|
||||
public boolean registerBook(book book) {
|
||||
public boolean registerBook(Book book) {
|
||||
if (!isValid(book)) {
|
||||
throw new IllegalArgumentException("Invalid book data provided");
|
||||
}
|
||||
@@ -15,20 +15,20 @@ public class bookManagement {
|
||||
return true;
|
||||
}
|
||||
|
||||
public List<book> getAllBooks() {
|
||||
public List<Book> getAllBooks() {
|
||||
return new ArrayList<>(books.values());
|
||||
}
|
||||
|
||||
public book getBookByIsbn(String isbn) {
|
||||
public Book getBookByIsbn(String isbn) {
|
||||
if (!books.containsKey(isbn)) {
|
||||
throw new NoSuchElementException("Book not found");
|
||||
}
|
||||
return books.get(isbn);
|
||||
}
|
||||
|
||||
public List<book> getBooksByTitle(String title) {
|
||||
public List<Book> getBooksByTitle(String title) {
|
||||
return books.values().stream()
|
||||
.filter(book -> book.getTitle().equalsIgnoreCase(title))
|
||||
.filter(Book -> Book.getTitle().equalsIgnoreCase(title))
|
||||
.toList();
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class bookManagement {
|
||||
return books.size();
|
||||
}
|
||||
|
||||
private boolean isValid(book book) {
|
||||
private boolean isValid(Book book) {
|
||||
return book != null &&
|
||||
notEmpty(book.getIsbn()) &&
|
||||
notEmpty(book.getTitle()) &&
|
@@ -1,11 +1,11 @@
|
||||
package fr.iut_fbleau.but3.dev62.mylibrary.book.bookError;
|
||||
package fr.iut_fbleau.but3.dev62.mylibrary.book.error;
|
||||
|
||||
import org.junit.jupiter.api.*;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import java.util.*;
|
||||
|
||||
@DisplayName("Book error and failure scenarios")
|
||||
public class error {
|
||||
public class bookErrorTest {
|
||||
|
||||
private String lastErrorMessage;
|
||||
private boolean lastOperationSuccess;
|
@@ -1,4 +1,8 @@
|
||||
package fr.iut_fbleau.but3.dev62.mylibrary.features.book;
|
||||
import fr.iut_fbleau.but3.dev62.mylibrary.book.error.bookErrorTest;
|
||||
import fr.iut_fbleau.but3.dev62.mylibrary.book.function.bookFunctionTest;
|
||||
import fr.iut_fbleau.but3.dev62.mylibrary.book.result.bookResultTest;
|
||||
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
|
Reference in New Issue
Block a user