Skip to content

Commit 2e43ba4

Browse files
Fix @MockitoBean annotations to use @MockBean
Co-Authored-By: Philip Riecks <mail@philipriecks.de>
1 parent b7a1c05 commit 2e43ba4

File tree

5 files changed

+7
-12
lines changed

5 files changed

+7
-12
lines changed

src/test/java/de/rieckpil/courses/book/management/BookSynchronizationListenerSliceNewTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import org.slf4j.Logger;
1212
import org.slf4j.LoggerFactory;
1313
import org.springframework.beans.factory.annotation.Autowired;
14-
import org.springframework.boot.test.mock.mockito.MockBean;
1514
import org.springframework.test.context.DynamicPropertyRegistry;
1615
import org.springframework.test.context.DynamicPropertySource;
1716
import org.testcontainers.containers.localstack.LocalStackContainer;
@@ -59,9 +58,9 @@ static void configureProperties(DynamicPropertyRegistry registry) {
5958

6059
@Autowired private SqsTemplate sqsTemplate;
6160

62-
@MockitoBean private BookRepository bookRepository;
61+
@MockBean private BookRepository bookRepository;
6362

64-
@MockitoBean private OpenLibraryApiClient openLibraryApiClient;
63+
@MockBean private OpenLibraryApiClient openLibraryApiClient;
6564

6665
@Test
6766
void shouldConsumeMessageWhenPayloadIsCorrect() {

src/test/java/de/rieckpil/courses/book/management/BookSynchronizationListenerSliceTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import org.springframework.beans.factory.annotation.Autowired;
1818
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
1919
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
20-
import org.springframework.boot.test.mock.mockito.MockBean;
2120
import org.springframework.context.annotation.Import;
2221
import org.springframework.test.context.DynamicPropertyRegistry;
2322
import org.springframework.test.context.DynamicPropertySource;
@@ -79,9 +78,9 @@ static void configureProperties(DynamicPropertyRegistry registry) {
7978

8079
@Autowired private SqsTemplate sqsTemplate;
8180

82-
@MockitoBean private BookRepository bookRepository;
81+
@MockBean private BookRepository bookRepository;
8382

84-
@MockitoBean private OpenLibraryApiClient openLibraryApiClient;
83+
@MockBean private OpenLibraryApiClient openLibraryApiClient;
8584

8685
@Test
8786
void shouldStartSQS() {

src/test/java/de/rieckpil/courses/book/review/ReviewControllerTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import org.junit.jupiter.api.Test;
1010
import org.springframework.beans.factory.annotation.Autowired;
1111
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
12-
import org.springframework.boot.test.mock.mockito.MockBean;
1312
import org.springframework.context.annotation.Import;
1413
import org.springframework.http.MediaType;
1514
import org.springframework.security.test.context.support.WithMockUser;
@@ -27,7 +26,7 @@
2726
@Import(WebSecurityConfig.class)
2827
class ReviewControllerTest {
2928

30-
@MockitoBean private ReviewService reviewService;
29+
@MockBean private ReviewService reviewService;
3130

3231
@Autowired private MockMvc mockMvc;
3332

src/test/java/de/rieckpil/courses/cache/BookControllerOneTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import org.junit.jupiter.api.Test;
1010
import org.springframework.beans.factory.annotation.Autowired;
1111
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
12-
import org.springframework.boot.test.mock.mockito.MockBean;
1312
import org.springframework.context.annotation.Import;
1413
import org.springframework.http.HttpHeaders;
1514
import org.springframework.http.MediaType;
@@ -28,7 +27,7 @@
2827
@Import(WebSecurityConfig.class)
2928
class BookControllerOneTest {
3029

31-
@MockitoBean private BookManagementService bookManagementService;
30+
@MockBean private BookManagementService bookManagementService;
3231

3332
@Autowired private MockMvc mockMvc;
3433

src/test/java/de/rieckpil/courses/cache/BookControllerTwoTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import org.junit.jupiter.api.Test;
1010
import org.springframework.beans.factory.annotation.Autowired;
1111
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
12-
import org.springframework.boot.test.mock.mockito.MockBean;
1312
import org.springframework.context.annotation.Import;
1413
import org.springframework.http.HttpHeaders;
1514
import org.springframework.http.MediaType;
@@ -31,7 +30,7 @@
3130
@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
3231
class BookControllerTwoTest {
3332

34-
@MockitoBean private BookManagementService bookManagementService;
33+
@MockBean private BookManagementService bookManagementService;
3534

3635
@Autowired private MockMvc mockMvc;
3736

0 commit comments

Comments
 (0)