From d294109733c543eb92cca32ab1427bcc962214c0 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Thu, 8 Aug 2024 16:00:29 +0200 Subject: [PATCH] Switch to manual mocking instead of using Mockito annotation. Closes #2409 --- ...itoryPropertyReferenceControllerIntegrationTests.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/RepositoryPropertyReferenceControllerIntegrationTests.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/RepositoryPropertyReferenceControllerIntegrationTests.java index 1814fc9de..6114f8c91 100755 --- a/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/RepositoryPropertyReferenceControllerIntegrationTests.java +++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/RepositoryPropertyReferenceControllerIntegrationTests.java @@ -16,13 +16,12 @@ package org.springframework.data.rest.webmvc; import static org.assertj.core.api.Assertions.*; +import static org.mockito.Mockito.*; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Answers; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.rest.tests.AbstractControllerIntegrationTests; import org.springframework.data.rest.webmvc.jpa.Book; @@ -36,7 +35,6 @@ /** * @author Oliver Gierke */ -@ExtendWith(MockitoExtension.class) @ContextConfiguration(classes = JpaRepositoryConfig.class) @Transactional class RepositoryPropertyReferenceControllerIntegrationTests extends AbstractControllerIntegrationTests { @@ -45,7 +43,8 @@ class RepositoryPropertyReferenceControllerIntegrationTests extends AbstractCont @Autowired TestDataPopulator populator; @Autowired BookRepository books; - @Mock(answer = Answers.RETURNS_MOCKS) RepresentationModelAssemblers assembler; + RepresentationModelAssemblers assembler = mock(RepresentationModelAssemblers.class, + withSettings().defaultAnswer(Answers.RETURNS_MOCKS)); RootResourceInformation information; @BeforeEach