diff --git a/pom.xml b/pom.xml index f76b5f5..1f92b9e 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 3.3.5 + 3.4.0 de.workshops diff --git a/src/test/java/de/workshops/bookshelf/book/BookRestControllerMockitoIntegrationTest.java b/src/test/java/de/workshops/bookshelf/book/BookRestControllerMockitoIntegrationTest.java index 274e3dd..4532220 100644 --- a/src/test/java/de/workshops/bookshelf/book/BookRestControllerMockitoIntegrationTest.java +++ b/src/test/java/de/workshops/bookshelf/book/BookRestControllerMockitoIntegrationTest.java @@ -1,5 +1,7 @@ package de.workshops.bookshelf.book; +import java.util.Collections; +import java.util.List; import org.hamcrest.Matchers; import org.junit.jupiter.api.Test; import org.mockito.Mockito; @@ -7,18 +9,15 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.FilterType; import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import org.springframework.test.web.servlet.result.MockMvcResultHandlers; import org.springframework.test.web.servlet.result.MockMvcResultMatchers; -import java.util.Collections; -import java.util.List; - @WebMvcTest( controllers = BookRestController.class, includeFilters = @ComponentScan.Filter( @@ -32,7 +31,7 @@ class BookRestControllerMockitoIntegrationTest { @Autowired private MockMvc mockMvc; - @MockBean + @MockitoBean private BookService bookService; @Test diff --git a/src/test/java/de/workshops/bookshelf/book/BookRestControllerMockitoTest.java b/src/test/java/de/workshops/bookshelf/book/BookRestControllerMockitoTest.java index 169dd51..936930c 100644 --- a/src/test/java/de/workshops/bookshelf/book/BookRestControllerMockitoTest.java +++ b/src/test/java/de/workshops/bookshelf/book/BookRestControllerMockitoTest.java @@ -1,16 +1,17 @@ package de.workshops.bookshelf.book; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; + +import java.util.Collections; +import java.util.List; import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.http.HttpStatus; - -import java.util.Collections; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.*; +import org.springframework.test.context.bean.override.mockito.MockitoBean; @WebMvcTest(BookRestController.class) class BookRestControllerMockitoTest { @@ -18,7 +19,7 @@ class BookRestControllerMockitoTest { @Autowired private BookRestController bookRestController; - @MockBean + @MockitoBean private BookService bookService; @Test