Skip to content

Commit 40d503a

Browse files
DevDengChaojgrandja
authored andcommitted
Replace @MockBean with @MockitoBean
Closes gh-1972 Signed-off-by: DevDengChao <[email protected]>
1 parent 76e3b03 commit 40d503a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

samples/default-authorizationserver/src/test/java/sample/DefaultAuthorizationServerConsentTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131
import org.springframework.beans.factory.annotation.Autowired;
3232
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
3333
import org.springframework.boot.test.context.SpringBootTest;
34-
import org.springframework.boot.test.mock.mockito.MockBean;
3534
import org.springframework.http.HttpStatus;
3635
import org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationConsentService;
3736
import org.springframework.security.test.context.support.WithMockUser;
37+
import org.springframework.test.context.bean.override.mockito.MockitoBean;
3838
import org.springframework.test.context.junit.jupiter.SpringExtension;
3939
import org.springframework.web.util.UriComponentsBuilder;
4040

@@ -55,7 +55,7 @@ public class DefaultAuthorizationServerConsentTests {
5555
@Autowired
5656
private WebClient webClient;
5757

58-
@MockBean
58+
@MockitoBean
5959
private OAuth2AuthorizationConsentService authorizationConsentService;
6060

6161
private final String redirectUri = "http://127.0.0.1/login/oauth2/code/messaging-client-oidc";

samples/demo-authorizationserver/src/test/java/sample/DemoAuthorizationServerConsentTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131
import org.springframework.beans.factory.annotation.Autowired;
3232
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
3333
import org.springframework.boot.test.context.SpringBootTest;
34-
import org.springframework.boot.test.mock.mockito.MockBean;
3534
import org.springframework.http.HttpStatus;
3635
import org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationConsentService;
3736
import org.springframework.security.test.context.support.WithMockUser;
37+
import org.springframework.test.context.bean.override.mockito.MockitoBean;
3838
import org.springframework.test.context.junit.jupiter.SpringExtension;
3939
import org.springframework.web.util.UriComponentsBuilder;
4040

@@ -55,7 +55,7 @@ public class DemoAuthorizationServerConsentTests {
5555
@Autowired
5656
private WebClient webClient;
5757

58-
@MockBean
58+
@MockitoBean
5959
private OAuth2AuthorizationConsentService authorizationConsentService;
6060

6161
private final String redirectUri = "http://127.0.0.1/login/oauth2/code/messaging-client-oidc";

0 commit comments

Comments
 (0)