forked from pierront/mylibrary-template
✅ Reussite du test converter ToDomain après l'ajout des variable manquante
This commit is contained in:
@@ -10,12 +10,14 @@ import java.util.ArrayList;
|
||||
@Getter
|
||||
@Builder
|
||||
public class BookDTO {
|
||||
private ArrayList<String> categories = new ArrayList<>();
|
||||
private String description ;
|
||||
private String language;
|
||||
private String isbn;
|
||||
private String title;
|
||||
private String author;
|
||||
private String editor;
|
||||
private LocalDate date;
|
||||
|
||||
private double price;
|
||||
private Integer stock;
|
||||
private ArrayList<String> categories = new ArrayList<>();
|
||||
private String description ;
|
||||
private String language;
|
||||
}
|
||||
|
||||
@@ -10,10 +10,13 @@ public final class BookConverter {
|
||||
|
||||
public static BookDTO ToDomain(BookInfo bookinfo, BookDetails bookdetails){
|
||||
return BookDTO.builder()
|
||||
.isbn("0000000000000")
|
||||
.title(bookinfo.title())
|
||||
.author(bookinfo.author())
|
||||
.editor(bookinfo.editor())
|
||||
.date(bookinfo.date())
|
||||
.price(50.99)
|
||||
.stock(5)
|
||||
.categories(bookdetails.getCategories())
|
||||
.description(bookdetails.getDescription())
|
||||
.language(bookdetails.getLanguage())
|
||||
|
||||
@@ -10,12 +10,14 @@ import java.util.ArrayList;
|
||||
@Getter
|
||||
@Builder
|
||||
public class Book {
|
||||
private ArrayList<String> categories = new ArrayList<>();
|
||||
private String description ;
|
||||
private String language;
|
||||
private String isbn;
|
||||
private String title;
|
||||
private String author;
|
||||
private String editor;
|
||||
private LocalDate date;
|
||||
|
||||
private double price;
|
||||
private Integer stock;
|
||||
private ArrayList<String> categories = new ArrayList<>();
|
||||
private String description ;
|
||||
private String language;
|
||||
}
|
||||
|
||||
+4
-5
@@ -36,7 +36,6 @@ public class BookConverterTest {
|
||||
|
||||
BookDTO result = BookConverter.ToDomain(bookinfo, bookdetails);
|
||||
|
||||
//assertNotNull(result);
|
||||
assertEquals(bookinfo.title(), result.getTitle());
|
||||
assertEquals(bookinfo.author(), result.getAuthor());
|
||||
assertEquals(bookinfo.editor(), result.getEditor());
|
||||
@@ -46,16 +45,16 @@ public class BookConverterTest {
|
||||
assertEquals(bookdetails.getLanguage(), result.getLanguage());
|
||||
}
|
||||
}
|
||||
/**
|
||||
/*
|
||||
@Nested
|
||||
@DisplayName("toDTO() method tests")
|
||||
class ToDTOTests {
|
||||
LocalDate date = LocalDate.of(2026, 3, 24);
|
||||
ArrayList<String> categories = new ArrayList<String>();
|
||||
ArrayList<String> categories = new ArrayList<>();
|
||||
categories.add("Thriller");
|
||||
categories.add("Biographie");
|
||||
Book book = Book.builder()
|
||||
.isbn(1234567891012)
|
||||
.isbn("1234567891012")
|
||||
.title("La vie de Maxime")
|
||||
.author("Marvin Aubert")
|
||||
.editor("Kioon")
|
||||
@@ -69,5 +68,5 @@ public class BookConverterTest {
|
||||
|
||||
BookDTO result = BookConvert.ToDTO(book);
|
||||
|
||||
}**/
|
||||
}*/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user