forked from pierront/mylibrary-template
✅ Reussite du test des variables de Book
This commit is contained in:
@@ -0,0 +1,54 @@
|
|||||||
|
package fr.iut_fbleau.but3.dev62.mylibrary.book.entity;
|
||||||
|
|
||||||
|
import fr.iut_fbleau.but3.dev62.mylibrary.book.BookDTO;
|
||||||
|
import fr.iut_fbleau.but3.dev62.mylibrary.book.converter.BookConverter;
|
||||||
|
import org.junit.jupiter.api.DisplayName;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
public class BookTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Builder should create a valid Customer instance")
|
||||||
|
void testCustomerBuilder() {
|
||||||
|
String isbn = "1234567891012";
|
||||||
|
String title = "La vie de Maxime";
|
||||||
|
String author = "Marvin Aubert";
|
||||||
|
String editor = "Kioon";
|
||||||
|
LocalDate date = LocalDate.of(2026, 3, 24);
|
||||||
|
double price = 12.99;
|
||||||
|
Integer stock = 50;
|
||||||
|
ArrayList<String> categories = new ArrayList<>();
|
||||||
|
categories.add("Thriller");
|
||||||
|
categories.add("Biographie");
|
||||||
|
String description = "C'était un brave partit trop tôt";
|
||||||
|
String language = "Français";
|
||||||
|
Book book = Book.builder()
|
||||||
|
.isbn(isbn)
|
||||||
|
.title(title)
|
||||||
|
.author(author)
|
||||||
|
.editor(editor)
|
||||||
|
.date(date)
|
||||||
|
.price(price)
|
||||||
|
.stock(stock)
|
||||||
|
.categories(categories)
|
||||||
|
.description(description)
|
||||||
|
.language(language)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
assertEquals(isbn, book.getIsbn());
|
||||||
|
assertEquals(title, book.getTitle());
|
||||||
|
assertEquals(author, book.getAuthor());
|
||||||
|
assertEquals(editor, book.getEditor());
|
||||||
|
assertEquals(date, book.getDate());
|
||||||
|
assertEquals(price, book.getPrice());
|
||||||
|
assertEquals(stock, book.getStock());
|
||||||
|
assertEquals(categories, book.getCategories());
|
||||||
|
assertEquals(description, book.getDescription());
|
||||||
|
assertEquals(language, book.getLanguage());
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user