Skip to content

Commit 1ed8a0f

Browse files
committed
document spring-boot-test
1 parent a91434d commit 1ed8a0f

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,3 +204,28 @@ public class Application {
204204
}
205205
}
206206
```
207+
208+
#### Spring Boot test support
209+
210+
Adding the following dependency would let you mock the operator for the
211+
tests where loading the spring container is necessary,
212+
but it doesn't need real access to a Kubernetes cluster.
213+
214+
```xml
215+
<dependency>
216+
<groupId>io.javaoperatorsdk</groupId>
217+
<artifactId>operator-framework-spring-boot-starter-test</artifactId>
218+
<version>{see https://search.maven.org/search?q=a:operator-framework-spring-boot-starter for latest version}</version>
219+
</dependency>
220+
```
221+
222+
Mock the operator:
223+
```java
224+
@SpringBootTest
225+
@EnableMockOperator
226+
public class SpringBootStarterSampleApplicationTest {
227+
228+
@Test
229+
void contextLoads() {}
230+
}
231+
```

0 commit comments

Comments
 (0)