Skip to content

Commit 8b99493

Browse files
committed
style: fixed code format by maven build
1 parent 00c80ce commit 8b99493

File tree

2 files changed

+55
-55
lines changed

2 files changed

+55
-55
lines changed

Diff for: operator-framework-core/src/main/java/io/javaoperatorsdk/operator/Operator.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public void close() {
133133
* @throws OperatorException if a problem occurred during the registration process
134134
*/
135135
public <R extends CustomResource<?, ?>> void register(Reconciler<R> reconciler,
136-
ControllerConfiguration<R> configuration)
136+
ControllerConfiguration<R> configuration)
137137
throws OperatorException {
138138

139139
if (configuration == null) {
@@ -148,8 +148,8 @@ public void close() {
148148

149149
controllers.add(controller);
150150

151-
final var watchedNS =
152-
configuration.watchAllNamespaces() ? "[all namespaces]" : configuration.getEffectiveNamespaces();
151+
final var watchedNS = configuration.watchAllNamespaces() ? "[all namespaces]"
152+
: configuration.getEffectiveNamespaces();
153153

154154
log.info(
155155
"Registered Controller: '{}' for CRD: '{}' for namespace(s): {}",
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package io.javaoperatorsdk.operator;
22

3-
import static org.mockito.Mockito.mock;
4-
import static org.mockito.Mockito.verify;
5-
import static org.mockito.Mockito.when;
3+
import org.junit.jupiter.api.Assertions;
4+
import org.junit.jupiter.api.DisplayName;
5+
import org.junit.jupiter.api.Test;
66

77
import io.fabric8.kubernetes.client.CustomResource;
88
import io.fabric8.kubernetes.client.KubernetesClient;
@@ -11,65 +11,65 @@
1111
import io.javaoperatorsdk.operator.api.reconciler.Context;
1212
import io.javaoperatorsdk.operator.api.reconciler.Reconciler;
1313
import io.javaoperatorsdk.operator.api.reconciler.UpdateControl;
14-
import org.junit.jupiter.api.Assertions;
15-
import org.junit.jupiter.api.DisplayName;
16-
import org.junit.jupiter.api.Test;
14+
15+
import static org.mockito.Mockito.mock;
16+
import static org.mockito.Mockito.verify;
17+
import static org.mockito.Mockito.when;
1718

1819
class OperatorTest {
1920

20-
private final KubernetesClient kubernetesClient = mock(KubernetesClient.class);
21-
private final ConfigurationService configurationService = mock(ConfigurationService.class);
22-
private final ControllerConfiguration configuration = mock(ControllerConfiguration.class);
23-
24-
private final Operator operator = new Operator(kubernetesClient, configurationService);
25-
private final FooReconciler fooReconciler = FooReconciler.create();
26-
27-
@Test
28-
@DisplayName("should register `Reconciler` to Controller")
29-
public void shouldRegisterReconcilerToController() {
30-
// given
31-
when(configurationService.getConfigurationFor(fooReconciler)).thenReturn(configuration);
32-
when(configuration.watchAllNamespaces()).thenReturn(true);
33-
when(configuration.getName()).thenReturn("FOO");
34-
when(configuration.getCustomResourceClass()).thenReturn(FooReconciler.class);
35-
36-
// when
37-
operator.register(fooReconciler);
38-
39-
// then
40-
verify(configuration).watchAllNamespaces();
41-
verify(configuration).getName();
42-
verify(configuration).getCustomResourceClass();
43-
}
21+
private final KubernetesClient kubernetesClient = mock(KubernetesClient.class);
22+
private final ConfigurationService configurationService = mock(ConfigurationService.class);
23+
private final ControllerConfiguration configuration = mock(ControllerConfiguration.class);
4424

45-
@Test
46-
@DisplayName("should throw `OperationException` when Configuration is null")
47-
public void shouldThrowOperatorExceptionWhenConfigurationIsNull() {
48-
Assertions.assertThrows(OperatorException.class, () -> operator.register(fooReconciler, null));
49-
}
25+
private final Operator operator = new Operator(kubernetesClient, configurationService);
26+
private final FooReconciler fooReconciler = FooReconciler.create();
5027

51-
private static class FooCustomResource extends CustomResource<FooSpec, FooStatus> {
52-
}
28+
@Test
29+
@DisplayName("should register `Reconciler` to Controller")
30+
public void shouldRegisterReconcilerToController() {
31+
// given
32+
when(configurationService.getConfigurationFor(fooReconciler)).thenReturn(configuration);
33+
when(configuration.watchAllNamespaces()).thenReturn(true);
34+
when(configuration.getName()).thenReturn("FOO");
35+
when(configuration.getCustomResourceClass()).thenReturn(FooReconciler.class);
5336

54-
private static class FooSpec {
55-
}
37+
// when
38+
operator.register(fooReconciler);
5639

57-
private static class FooStatus {
58-
}
40+
// then
41+
verify(configuration).watchAllNamespaces();
42+
verify(configuration).getName();
43+
verify(configuration).getCustomResourceClass();
44+
}
5945

60-
private static class FooReconciler implements Reconciler<FooCustomResource> {
46+
@Test
47+
@DisplayName("should throw `OperationException` when Configuration is null")
48+
public void shouldThrowOperatorExceptionWhenConfigurationIsNull() {
49+
Assertions.assertThrows(OperatorException.class, () -> operator.register(fooReconciler, null));
50+
}
6151

62-
private FooReconciler() {
63-
}
52+
private static class FooCustomResource extends CustomResource<FooSpec, FooStatus> {
53+
}
6454

65-
public static FooReconciler create() {
66-
return new FooReconciler();
67-
}
55+
private static class FooSpec {
56+
}
57+
58+
private static class FooStatus {
59+
}
60+
61+
private static class FooReconciler implements Reconciler<FooCustomResource> {
62+
63+
private FooReconciler() {}
64+
65+
public static FooReconciler create() {
66+
return new FooReconciler();
67+
}
6868

69-
@Override
70-
public UpdateControl<FooCustomResource> reconcile(FooCustomResource resource, Context context) {
71-
return UpdateControl.updateStatusSubResource(resource);
72-
}
69+
@Override
70+
public UpdateControl<FooCustomResource> reconcile(FooCustomResource resource, Context context) {
71+
return UpdateControl.updateStatusSubResource(resource);
7372
}
73+
}
7474

75-
}
75+
}

0 commit comments

Comments
 (0)