Jean-Francois Leveque

Passage à JUnit Jupiter (nouveauté v5)

package org.legrog.web.book;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.platform.runner.JUnitPlatform;
import org.junit.runner.RunWith;
import org.legrog.entities.Book;
import org.legrog.test.MockitoExtension;
import org.legrog.web.book.BookServiceOld;
import org.mockito.Answers;
import org.mockito.Mock;
......@@ -18,15 +22,16 @@ import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
@RunWith(MockitoJUnitRunner.class)
public class BookServiceOldTest {
@RunWith(JUnitPlatform.class)
@ExtendWith(MockitoExtension.class)
public class BookServiceOldTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
private EntityManager entityManager;
private BookServiceOld bookServiceOld;
@Before
@BeforeEach
public void setUp() {
bookServiceOld = new BookServiceOld(entityManager);
}
......
package org.legrog.web.publisher;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
......
package org.legrog.web.publisher;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.platform.runner.JUnitPlatform;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.DisplayName;
import org.legrog.entities.Publisher;
import org.legrog.entities.PublisherAction;
import org.legrog.entities.PublisherVersion;
import org.legrog.test.MockitoExtension;
import org.mockito.Answers;
import org.mockito.Mock;
import org.mockito.Mockito;
......@@ -23,7 +26,8 @@ import static org.mockito.Mockito.*;
/**
* Classe testant ListPublisherVersionsView.
*/
@RunWith(MockitoJUnitRunner.class)
@RunWith(JUnitPlatform.class)
@ExtendWith(MockitoExtension.class)
@DisplayName("Listes de versions d'éditeurs")
public class ListPublisherVersionsViewTest {
Logger logger = LoggerFactory.getLogger(getClass());
......@@ -40,7 +44,7 @@ public class ListPublisherVersionsViewTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
private PublisherService publisherService;
@Before
@BeforeEach
public void setUp() {
// Données
......