Skip to content

Commit 432a8bb

Browse files
committed
update code style
1 parent bdc4836 commit 432a8bb

File tree

3 files changed

+25
-28
lines changed

3 files changed

+25
-28
lines changed

operator-framework-spring-boot-starter-test/src/main/java/io/javaoperatorsdk/operator/springboot/starter/test/EnableMockOperator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@
1919
*/
2020
@PropertyMapping("crd-paths")
2121
String[] crdPaths() default {};
22-
2322
}

operator-framework-spring-boot-starter-test/src/main/java/io/javaoperatorsdk/operator/springboot/starter/test/TestConfiguration.java

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,25 +41,26 @@ public KubernetesMockServer k8sMockServer() {
4141
}
4242

4343
@Bean
44-
public KubernetesClient kubernetesClient(KubernetesMockServer server,
45-
TestConfigurationProperties properties) {
44+
public KubernetesClient kubernetesClient(
45+
KubernetesMockServer server, TestConfigurationProperties properties) {
4646
final var client = server.createClient();
4747

48-
properties.getCrdPaths().forEach(
49-
crdPath -> {
50-
CustomResourceDefinition crd;
51-
try {
52-
crd = Serialization.unmarshal(new FileInputStream(ResourceUtils.getFile(crdPath)));
53-
} catch (FileNotFoundException e) {
54-
log.warn("CRD with path {} not found!", crdPath);
55-
e.printStackTrace();
56-
return;
57-
}
48+
properties
49+
.getCrdPaths()
50+
.forEach(
51+
crdPath -> {
52+
CustomResourceDefinition crd;
53+
try {
54+
crd = Serialization.unmarshal(new FileInputStream(ResourceUtils.getFile(crdPath)));
55+
} catch (FileNotFoundException e) {
56+
log.warn("CRD with path {} not found!", crdPath);
57+
e.printStackTrace();
58+
return;
59+
}
5860

59-
client.apiextensions().v1().customResourceDefinitions().create(crd);
60-
});
61+
client.apiextensions().v1().customResourceDefinitions().create(crd);
62+
});
6163

6264
return client;
6365
}
64-
6566
}

operator-framework-spring-boot-starter-test/src/test/java/io/javaoperatorsdk/operator/springboot/starter/test/EnableMockOperatorTests.java

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,21 @@
1414
@EnableMockOperator(crdPaths = "classpath:crd.yml")
1515
class EnableMockOperatorTests {
1616

17-
@Autowired
18-
KubernetesClient client;
17+
@Autowired KubernetesClient client;
1918

20-
@Autowired
21-
ApplicationContext applicationContext;
19+
@Autowired ApplicationContext applicationContext;
2220

2321
@Test
2422
void testCrdLoaded() {
25-
assertThat(applicationContext.getBean(Operator.class))
23+
assertThat(applicationContext.getBean(Operator.class)).isNotNull();
24+
assertThat(
25+
client
26+
.customResourceDefinitions()
27+
.withName("customservices.sample.javaoperatorsdk")
28+
.get())
2629
.isNotNull();
27-
assertThat(client.customResourceDefinitions()
28-
.withName("customservices.sample.javaoperatorsdk")
29-
.get()).isNotNull();
3030
}
3131

3232
@SpringBootApplication
33-
static class SpringBootTestApplication {
34-
35-
}
36-
33+
static class SpringBootTestApplication {}
3734
}

0 commit comments

Comments
 (0)