File tree Expand file tree Collapse file tree 13 files changed +46
-57
lines changed
spring-cloud-kubernetes-client-autoconfig
spring-cloud-kubernetes-client-config
spring-cloud-kubernetes-client-loadbalancer
spring-cloud-kubernetes-commons
spring-cloud-kubernetes-controllers
spring-cloud-kubernetes-configserver
spring-cloud-kubernetes-configuration-watcher
spring-cloud-kubernetes-fabric8-autoconfig
spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config
locator_retry/config_retry_enabled
spring-cloud-kubernetes-fabric8-discovery
spring-cloud-kubernetes-fabric8-loadbalancer Expand file tree Collapse file tree 13 files changed +46
-57
lines changed Original file line number Diff line number Diff line change 1919<project xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
2020 xmlns =" http://maven.apache.org/POM/4.0.0"
2121 xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" >
22-
22+
2323 <modelVersion >4.0.0</modelVersion >
2424
2525 <parent >
155155 <scope >import</scope >
156156 </dependency >
157157
158- <!-- Spring Boot 3.1 uses Mockito 5.x. Mockito 5.x has removed support for mockito-inline.-->
159- <!-- https://github.com/mockito/mockito/issues/2877-->
160- <!-- We need to support both Boot 3.0.x and Boot 3.1.x with Spring Cloud K8s 3.0.x-->
161- <!-- To maintain compatibility we manage the version ourselves-->
162- <!-- TODO Remove this and all references to mockito-inline in the next minor -->
163- <dependency >
164- <groupId >org.mockito</groupId >
165- <artifactId >mockito-bom</artifactId >
166- <version >${mockito-inline.version} </version >
167- <type >pom</type >
168- <scope >import</scope >
169- </dependency >
170-
171158 <dependency >
172159 <groupId >org.codehaus.groovy</groupId >
173160 <artifactId >groovy-all</artifactId >
Original file line number Diff line number Diff line change 5151 </dependency >
5252 <dependency >
5353 <groupId >org.mockito</groupId >
54- <artifactId >mockito-inline </artifactId >
54+ <artifactId >mockito-core </artifactId >
5555 <scope >test</scope >
5656 </dependency >
5757 <dependency >
Original file line number Diff line number Diff line change 106106 </dependency >
107107 <dependency >
108108 <groupId >org.mockito</groupId >
109- <artifactId >mockito-inline </artifactId >
109+ <artifactId >mockito-core </artifactId >
110110 <scope >test</scope >
111111 </dependency >
112112 <dependency >
Original file line number Diff line number Diff line change 4545
4646 <dependency >
4747 <groupId >org.mockito</groupId >
48- <artifactId >mockito-inline </artifactId >
48+ <artifactId >mockito-core </artifactId >
4949 <scope >test</scope >
5050 </dependency >
5151
Original file line number Diff line number Diff line change 9999 </dependency >
100100 <dependency >
101101 <groupId >org.mockito</groupId >
102- <artifactId >mockito-inline </artifactId >
102+ <artifactId >mockito-core </artifactId >
103103 <scope >test</scope >
104104 </dependency >
105105 <dependency >
Original file line number Diff line number Diff line change 3333 <dependency >
3434 <groupId >org.springframework.boot</groupId >
3535 <artifactId >spring-boot-starter-test</artifactId >
36- <!-- in favor of mockito-inline -->
37- <exclusions >
38- <exclusion >
39- <groupId >org.mockito</groupId >
40- <artifactId >mockito-core</artifactId >
41- </exclusion >
42- </exclusions >
4336 <scope >test</scope >
4437 </dependency >
4538 <dependency >
4942 </dependency >
5043 <dependency >
5144 <groupId >org.mockito</groupId >
52- <artifactId >mockito-inline </artifactId >
45+ <artifactId >mockito-core </artifactId >
5346 <scope >test</scope >
5447 </dependency >
5548 <dependency >
Original file line number Diff line number Diff line change 4242 <groupId >org.springframework.boot</groupId >
4343 <artifactId >spring-boot-starter-test</artifactId >
4444 <scope >test</scope >
45- <!-- In favor of mockito-inline -->
46- <exclusions >
47- <exclusion >
48- <groupId >org.mockito</groupId >
49- <artifactId >mockito-core</artifactId >
50- </exclusion >
51- </exclusions >
5245 </dependency >
5346 <dependency >
5447 <groupId >org.wiremock</groupId >
6861 </dependency >
6962 <dependency >
7063 <groupId >org.mockito</groupId >
71- <artifactId >mockito-inline </artifactId >
64+ <artifactId >mockito-core </artifactId >
7265 <scope >test</scope >
7366 </dependency >
7467 <dependency >
Original file line number Diff line number Diff line change 8484 <dependency >
8585 <groupId >org.springframework.boot</groupId >
8686 <artifactId >spring-boot-starter-test</artifactId >
87- <!-- in favor of mockito-inline -->
88- <exclusions >
89- <exclusion >
90- <groupId >org.mockito</groupId >
91- <artifactId >mockito-core</artifactId >
92- </exclusion >
93- </exclusions >
9487 <scope >test</scope >
9588 </dependency >
9689 <dependency >
122115
123116 <dependency >
124117 <groupId >org.mockito</groupId >
125- <artifactId >mockito-inline </artifactId >
118+ <artifactId >mockito-core </artifactId >
126119 <scope >test</scope >
127120 </dependency >
128121 <dependency >
Original file line number Diff line number Diff line change 1919import io .fabric8 .kubernetes .client .KubernetesClient ;
2020import io .fabric8 .kubernetes .client .server .mock .EnableKubernetesMockClient ;
2121import io .fabric8 .kubernetes .client .server .mock .KubernetesMockServer ;
22+ import org .junit .jupiter .api .AfterEach ;
2223import org .junit .jupiter .api .BeforeAll ;
2324import org .junit .jupiter .api .BeforeEach ;
25+ import org .mockito .Mockito ;
26+ import org .mockito .internal .util .MockUtil ;
2427
2528import org .springframework .beans .factory .annotation .Autowired ;
2629import org .springframework .boot .test .mock .mockito .MockBean ;
@@ -56,8 +59,20 @@ static void setup() {
5659 @ BeforeEach
5760 void beforeEach () {
5861 psl = propertySourceLocator ;
59- verifiablePsl = spy (propertySourceLocator .getConfigMapPropertySourceLocator ());
60- propertySourceLocator .setConfigMapPropertySourceLocator (verifiablePsl );
62+ // latest Mockito does not allow to do something like Mockito.spy(spy)
63+ // so this works around that
64+ if (!MockUtil .isSpy (propertySourceLocator .getConfigMapPropertySourceLocator ())) {
65+ verifiablePsl = spy (propertySourceLocator .getConfigMapPropertySourceLocator ());
66+ propertySourceLocator .setConfigMapPropertySourceLocator (verifiablePsl );
67+ }
68+ else {
69+ verifiablePsl = propertySourceLocator .getConfigMapPropertySourceLocator ();
70+ }
71+ }
72+
73+ @ AfterEach
74+ void afterEach () {
75+ Mockito .reset (verifiablePsl );
6176 }
6277
6378}
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ static void setup() {
4343 private Fabric8SecretsPropertySourceLocator propertySourceLocator ;
4444
4545 @ BeforeEach
46- public void beforeEach () {
46+ void beforeEach () {
4747 psl = propertySourceLocator ;
4848 verifiablePsl = propertySourceLocator ;
4949 }
You can’t perform that action at this time.
0 commit comments