Début de la feature avec des tests de base sur les variables #3
@@ -10,12 +10,14 @@ import java.util.ArrayList;
|
|||||||
@Getter
|
@Getter
|
||||||
@Builder
|
@Builder
|
||||||
public class BookDTO {
|
public class BookDTO {
|
||||||
private ArrayList<String> categories = new ArrayList<>();
|
private String isbn;
|
||||||
private String description ;
|
|
||||||
private String language;
|
|
||||||
private String title;
|
private String title;
|
||||||
private String author;
|
private String author;
|
||||||
private String editor;
|
private String editor;
|
||||||
private LocalDate date;
|
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){
|
public static BookDTO ToDomain(BookInfo bookinfo, BookDetails bookdetails){
|
||||||
return BookDTO.builder()
|
return BookDTO.builder()
|
||||||
|
.isbn("0000000000000")
|
||||||
.title(bookinfo.title())
|
.title(bookinfo.title())
|
||||||
.author(bookinfo.author())
|
.author(bookinfo.author())
|
||||||
.editor(bookinfo.editor())
|
.editor(bookinfo.editor())
|
||||||
.date(bookinfo.date())
|
.date(bookinfo.date())
|
||||||
|
.price(50.99)
|
||||||
|
.stock(5)
|
||||||
.categories(bookdetails.getCategories())
|
.categories(bookdetails.getCategories())
|
||||||
.description(bookdetails.getDescription())
|
.description(bookdetails.getDescription())
|
||||||
.language(bookdetails.getLanguage())
|
.language(bookdetails.getLanguage())
|
||||||
|
|||||||
@@ -10,12 +10,14 @@ import java.util.ArrayList;
|
|||||||
@Getter
|
@Getter
|
||||||
@Builder
|
@Builder
|
||||||
public class Book {
|
public class Book {
|
||||||
private ArrayList<String> categories = new ArrayList<>();
|
private String isbn;
|
||||||
private String description ;
|
|
||||||
private String language;
|
|
||||||
private String title;
|
private String title;
|
||||||
private String author;
|
private String author;
|
||||||
private String editor;
|
private String editor;
|
||||||
private LocalDate date;
|
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);
|
BookDTO result = BookConverter.ToDomain(bookinfo, bookdetails);
|
||||||
|
|
||||||
//assertNotNull(result);
|
|
||||||
assertEquals(bookinfo.title(), result.getTitle());
|
assertEquals(bookinfo.title(), result.getTitle());
|
||||||
assertEquals(bookinfo.author(), result.getAuthor());
|
assertEquals(bookinfo.author(), result.getAuthor());
|
||||||
assertEquals(bookinfo.editor(), result.getEditor());
|
assertEquals(bookinfo.editor(), result.getEditor());
|
||||||
@@ -46,16 +45,16 @@ public class BookConverterTest {
|
|||||||
assertEquals(bookdetails.getLanguage(), result.getLanguage());
|
assertEquals(bookdetails.getLanguage(), result.getLanguage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/*
|
||||||
@Nested
|
@Nested
|
||||||
@DisplayName("toDTO() method tests")
|
@DisplayName("toDTO() method tests")
|
||||||
class ToDTOTests {
|
class ToDTOTests {
|
||||||
LocalDate date = LocalDate.of(2026, 3, 24);
|
LocalDate date = LocalDate.of(2026, 3, 24);
|
||||||
ArrayList<String> categories = new ArrayList<String>();
|
ArrayList<String> categories = new ArrayList<>();
|
||||||
categories.add("Thriller");
|
categories.add("Thriller");
|
||||||
categories.add("Biographie");
|
categories.add("Biographie");
|
||||||
Book book = Book.builder()
|
Book book = Book.builder()
|
||||||
.isbn(1234567891012)
|
.isbn("1234567891012")
|
||||||
.title("La vie de Maxime")
|
.title("La vie de Maxime")
|
||||||
.author("Marvin Aubert")
|
.author("Marvin Aubert")
|
||||||
.editor("Kioon")
|
.editor("Kioon")
|
||||||
@@ -69,5 +68,5 @@ public class BookConverterTest {
|
|||||||
|
|
||||||
BookDTO result = BookConvert.ToDTO(book);
|
BookDTO result = BookConvert.ToDTO(book);
|
||||||
|
|
||||||
}**/
|
}*/
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user