forked from pierront/mylibrary-template
J'avais oublié des customer dans book
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
package fr.iut_fbleau.but3.dev62.mylibrary.book.usecase;
|
package fr.iut_fbleau.but3.dev62.mylibrary.book.usecase;
|
||||||
|
|
||||||
import fr.iut_fbleau.but3.dev62.mylibrary.customer.CustomerInfo;
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.DisplayName;
|
import org.junit.jupiter.api.DisplayName;
|
||||||
import org.junit.jupiter.api.Nested;
|
import org.junit.jupiter.api.Nested;
|
||||||
@@ -21,7 +20,7 @@ import static org.mockito.Mockito.*;
|
|||||||
public class BookUseCaseTest {
|
public class BookUseCaseTest {
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private BookRepository customerRepository;
|
private BookRepository bookRepository;
|
||||||
|
|
||||||
@InjectMocks
|
@InjectMocks
|
||||||
private BookUseCase bookUseCase;
|
private BookUseCase bookUseCase;
|
||||||
@@ -47,7 +46,7 @@ public class BookUseCaseTest {
|
|||||||
.language("Francais")
|
.language("Francais")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
validBookInfo = new CustomerInfo("LivreRandom", "John Doe", "RandomPublisher", date, 12.5, 50, cat, "Je suis un livre qui est composé de mots.", "Francais");
|
validBookInfo = new BookInfo("LivreRandom", "John Doe", "RandomPublisher", date, 12.5, 50, cat, "Je suis un livre qui est composé de mots.", "Francais");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -57,7 +56,7 @@ public class BookUseCaseTest {
|
|||||||
public class RegisterBookTests {
|
public class RegisterBookTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Should register customer when valid data is provided")
|
@DisplayName("Should register book when valid data is provided")
|
||||||
void testRegisterBookWithValidData() throws NotValidBookException {
|
void testRegisterBookWithValidData() throws NotValidBookException {
|
||||||
when(BookRepository.save(any(Book.class))).thenReturn(testBook);
|
when(BookRepository.save(any(Book.class))).thenReturn(testBook);
|
||||||
|
|
||||||
@@ -69,7 +68,7 @@ public class BookUseCaseTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("Should throw exception when customer data is not valid")
|
@DisplayName("Should throw exception when book data is not valid")
|
||||||
void testRegisterBookWithInvalidData() {
|
void testRegisterBookWithInvalidData() {
|
||||||
BookInfo invalidBookInfo = new BookInfo("", "", "");
|
BookInfo invalidBookInfo = new BookInfo("", "", "");
|
||||||
|
|
||||||
@@ -86,7 +85,7 @@ public class BookUseCaseTest {
|
|||||||
|
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@DisplayName("Find customer tests")
|
@DisplayName("Find book tests")
|
||||||
class FindBookTests {
|
class FindBookTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Reference in New Issue
Block a user