77import java .util .function .BiFunction ;
88import java .util .function .Supplier ;
99
10- import io .fabric8 .kubernetes .client .utils .KubernetesSerialization ;
11- import io .javaoperatorsdk .operator .api .reconciler .DefaultContext ;
1210import org .junit .jupiter .api .BeforeEach ;
1311import org .junit .jupiter .api .Test ;
1412import org .mockito .ArgumentCaptor ;
1917import io .fabric8 .kubernetes .api .model .ObjectMeta ;
2018import io .fabric8 .kubernetes .client .CustomResource ;
2119import io .fabric8 .kubernetes .client .KubernetesClientException ;
20+ import io .fabric8 .kubernetes .client .utils .KubernetesSerialization ;
2221import io .javaoperatorsdk .operator .MockKubernetesClient ;
2322import io .javaoperatorsdk .operator .OperatorException ;
2423import io .javaoperatorsdk .operator .TestUtils ;
2928import io .javaoperatorsdk .operator .api .config .MockControllerConfiguration ;
3029import io .javaoperatorsdk .operator .api .reconciler .Cleaner ;
3130import io .javaoperatorsdk .operator .api .reconciler .Context ;
31+ import io .javaoperatorsdk .operator .api .reconciler .DefaultContext ;
3232import io .javaoperatorsdk .operator .api .reconciler .DeleteControl ;
3333import io .javaoperatorsdk .operator .api .reconciler .ErrorStatusUpdateControl ;
3434import io .javaoperatorsdk .operator .api .reconciler .Reconciler ;
@@ -70,8 +70,9 @@ void setup() {
7070 }
7171
7272 static void initConfigService (boolean useSSA ) {
73- initConfigService (useSSA ,true );
73+ initConfigService (useSSA , true );
7474 }
75+
7576 static void initConfigService (boolean useSSA , boolean noCloning ) {
7677 /*
7778 * We need this for mock reconcilers to properly generate the expected UpdateControl: without
@@ -82,18 +83,19 @@ static void initConfigService(boolean useSSA, boolean noCloning) {
8283 */
8384 configurationService =
8485 ConfigurationService .newOverriddenConfigurationService (new BaseConfigurationService (),
85- overrider -> overrider .checkingCRDAndValidateLocalModel (false )
86+ overrider -> overrider .checkingCRDAndValidateLocalModel (false )
8687
8788 .withResourceCloner (new Cloner () {
8889 @ Override
8990 public <R extends HasMetadata > R clone (R object ) {
90- if (noCloning ) {
91- return object ;
92- }else {
93- return new KubernetesSerialization ().clone (object );
91+ if (noCloning ) {
92+ return object ;
93+ } else {
94+ return new KubernetesSerialization ().clone (object );
95+ }
9496 }
95- }} )
96- .withUseSSAToPatchPrimaryResource (useSSA ));
97+ })
98+ .withUseSSAToPatchPrimaryResource (useSSA ));
9799 }
98100
99101 private <R extends HasMetadata > ReconciliationDispatcher <R > init (R customResource ,
@@ -669,22 +671,24 @@ void reSchedulesFromErrorHandler() {
669671
670672 @ Test
671673 void reconcilerContextUsesTheSameInstanceOfResourceAsParam () {
672- initConfigService (false ,false );
674+ initConfigService (false , false );
673675
674676 final ReconciliationDispatcher <TestCustomResource > dispatcher =
675- init (testCustomResource , reconciler , null , customResourceFacade , true );
677+ init (testCustomResource , reconciler , null , customResourceFacade , true );
676678
677679 testCustomResource .addFinalizer (DEFAULT_FINALIZER );
678- ArgumentCaptor <DefaultContext > contextArgumentCaptor = ArgumentCaptor .forClass (DefaultContext .class );
679- ArgumentCaptor <TestCustomResource > customResourceCaptor = ArgumentCaptor .forClass (TestCustomResource .class );
680+ ArgumentCaptor <DefaultContext > contextArgumentCaptor =
681+ ArgumentCaptor .forClass (DefaultContext .class );
682+ ArgumentCaptor <TestCustomResource > customResourceCaptor =
683+ ArgumentCaptor .forClass (TestCustomResource .class );
680684
681685 dispatcher .handleExecution (executionScopeWithCREvent (testCustomResource ));
682- verify (reconciler , times (1 ))
683- .reconcile (customResourceCaptor .capture (), contextArgumentCaptor .capture ());
686+ verify (reconciler , times (1 ))
687+ .reconcile (customResourceCaptor .capture (), contextArgumentCaptor .capture ());
684688
685- assertThat (contextArgumentCaptor .getValue ().getPrimaryResource ())
686- .isSameAs (customResourceCaptor .getValue ())
687- .isNotSameAs (testCustomResource );
689+ assertThat (contextArgumentCaptor .getValue ().getPrimaryResource ())
690+ .isSameAs (customResourceCaptor .getValue ())
691+ .isNotSameAs (testCustomResource );
688692 }
689693
690694 private ObservedGenCustomResource createObservedGenCustomResource () {
0 commit comments