diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientConfigReloadAutoConfigurationTest.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientConfigReloadAutoConfigurationTest.java index 7a4452512e..dacdd6bc89 100644 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientConfigReloadAutoConfigurationTest.java +++ b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientConfigReloadAutoConfigurationTest.java @@ -117,7 +117,7 @@ void beforeEach() { .build()); WireMock.stubFor(get(urlMatching("^/api/v1/namespaces/default/configmaps.*")) - .willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(TEST_CONFIGMAP)))); + .willReturn(aResponse().withStatus(200).withBody(JSON.serialize(TEST_CONFIGMAP)))); } // 1. watchers diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/BootstrapKubernetesClientSanitizeEnvEndpointStub.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/BootstrapKubernetesClientSanitizeEnvEndpointStub.java index 6d749706b5..688fe184a0 100644 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/BootstrapKubernetesClientSanitizeEnvEndpointStub.java +++ b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/BootstrapKubernetesClientSanitizeEnvEndpointStub.java @@ -92,10 +92,10 @@ public static void stubData() { secretList.addItemsItem(secretTwo); WireMock.stubFor(WireMock.get("/api/v1/namespaces/test/configmaps") - .willReturn(WireMock.aResponse().withStatus(200).withBody(new JSON().serialize(configMapList)))); + .willReturn(WireMock.aResponse().withStatus(200).withBody(JSON.serialize(configMapList)))); WireMock.stubFor(WireMock.get("/api/v1/namespaces/test/secrets") - .willReturn(WireMock.aResponse().withStatus(200).withBody(new JSON().serialize(secretList)))); + .willReturn(WireMock.aResponse().withStatus(200).withBody(JSON.serialize(secretList)))); } } diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/LabeledConfigMapWithPrefixConfigurationStub.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/LabeledConfigMapWithPrefixConfigurationStub.java index af228301ed..6e624ac0dd 100644 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/LabeledConfigMapWithPrefixConfigurationStub.java +++ b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/LabeledConfigMapWithPrefixConfigurationStub.java @@ -106,7 +106,7 @@ public static void stubData() { configMapList.addItemsItem(four); WireMock.stubFor(WireMock.get("/api/v1/namespaces/spring-k8s/configmaps") - .willReturn(WireMock.aResponse().withStatus(200).withBody(new JSON().serialize(configMapList)))); + .willReturn(WireMock.aResponse().withStatus(200).withBody(JSON.serialize(configMapList)))); } } diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/LabeledConfigMapWithProfileConfigurationStub.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/LabeledConfigMapWithProfileConfigurationStub.java index dd6b4311a3..cc3f042872 100644 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/LabeledConfigMapWithProfileConfigurationStub.java +++ b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/LabeledConfigMapWithProfileConfigurationStub.java @@ -173,7 +173,7 @@ public static void stubData() { configMaps.addItemsItem(greenPurpleConfigMapK8s); WireMock.stubFor(WireMock.get("/api/v1/namespaces/spring-k8s/configmaps") - .willReturn(WireMock.aResponse().withStatus(200).withBody(new JSON().serialize(configMaps)))); + .willReturn(WireMock.aResponse().withStatus(200).withBody(JSON.serialize(configMaps)))); } } diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/LabeledSecretWithPrefixConfigurationStub.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/LabeledSecretWithPrefixConfigurationStub.java index 14be133016..0cd2ec9a6b 100644 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/LabeledSecretWithPrefixConfigurationStub.java +++ b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/LabeledSecretWithPrefixConfigurationStub.java @@ -109,7 +109,7 @@ public static void stubData() { secrets.addItemsItem(four); WireMock.stubFor(WireMock.get("/api/v1/namespaces/spring-k8s/secrets") - .willReturn(WireMock.aResponse().withStatus(200).withBody(new JSON().serialize(secrets)))); + .willReturn(WireMock.aResponse().withStatus(200).withBody(JSON.serialize(secrets)))); } } diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/LabeledSecretWithProfileConfigurationStub.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/LabeledSecretWithProfileConfigurationStub.java index e73db32080..cbcecf53ec 100644 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/LabeledSecretWithProfileConfigurationStub.java +++ b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/LabeledSecretWithProfileConfigurationStub.java @@ -174,7 +174,7 @@ public static void stubData() { secrets.addItemsItem(greenPurpleSecretK8s); WireMock.stubFor(WireMock.get("/api/v1/namespaces/spring-k8s/secrets") - .willReturn(WireMock.aResponse().withStatus(200).withBody(new JSON().serialize(secrets)))); + .willReturn(WireMock.aResponse().withStatus(200).withBody(JSON.serialize(secrets)))); } } diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/NamedConfigMapWithPrefixConfigurationStub.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/NamedConfigMapWithPrefixConfigurationStub.java index 8c162c04e4..4ed5ed8a4a 100644 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/NamedConfigMapWithPrefixConfigurationStub.java +++ b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/NamedConfigMapWithPrefixConfigurationStub.java @@ -94,7 +94,7 @@ public static void stubData() { // the actual stub for CoreV1Api calls WireMock.stubFor(WireMock.get("/api/v1/namespaces/spring-k8s/configmaps") - .willReturn(WireMock.aResponse().withStatus(200).withBody(new JSON().serialize(allConfigMaps)))); + .willReturn(WireMock.aResponse().withStatus(200).withBody(JSON.serialize(allConfigMaps)))); } } diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/NamedConfigMapWithProfileConfigurationStub.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/NamedConfigMapWithProfileConfigurationStub.java index 5f89657ab6..159bae70bf 100644 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/NamedConfigMapWithProfileConfigurationStub.java +++ b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/NamedConfigMapWithProfileConfigurationStub.java @@ -106,7 +106,7 @@ public static void stubData() { // the actual stub for CoreV1Api calls WireMock.stubFor(WireMock.get("/api/v1/namespaces/spring-k8s/configmaps") - .willReturn(WireMock.aResponse().withStatus(200).withBody(new JSON().serialize(allConfigMaps)))); + .willReturn(WireMock.aResponse().withStatus(200).withBody(JSON.serialize(allConfigMaps)))); } } diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/NamedSecretWithPrefixConfigurationStub.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/NamedSecretWithPrefixConfigurationStub.java index 9a3a1cc5cd..ed21af0423 100644 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/NamedSecretWithPrefixConfigurationStub.java +++ b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/NamedSecretWithPrefixConfigurationStub.java @@ -93,7 +93,7 @@ public static void stubData() { // the actual stub for CoreV1Api calls WireMock.stubFor(WireMock.get("/api/v1/namespaces/spring-k8s/secrets") - .willReturn(WireMock.aResponse().withStatus(200).withBody(new JSON().serialize(allSecrets)))); + .willReturn(WireMock.aResponse().withStatus(200).withBody(JSON.serialize(allSecrets)))); } } diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/NamedSecretWithProfileConfigurationStub.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/NamedSecretWithProfileConfigurationStub.java index 25ebf5dce2..2e7a294498 100644 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/NamedSecretWithProfileConfigurationStub.java +++ b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/NamedSecretWithProfileConfigurationStub.java @@ -123,7 +123,7 @@ public static void stubData() { // the actual stub for CoreV1Api calls WireMock.stubFor(WireMock.get("/api/v1/namespaces/spring-k8s/secrets") - .willReturn(WireMock.aResponse().withStatus(200).withBody(new JSON().serialize(allSecrets)))); + .willReturn(WireMock.aResponse().withStatus(200).withBody(JSON.serialize(allSecrets)))); } } diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/SingleSourceMultipleFilesConfigurationStub.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/SingleSourceMultipleFilesConfigurationStub.java index 769e865a3d..d4865873fe 100644 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/SingleSourceMultipleFilesConfigurationStub.java +++ b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/SingleSourceMultipleFilesConfigurationStub.java @@ -83,7 +83,7 @@ public static void stubData() { // the actual stub for CoreV1Api calls WireMock.stubFor(WireMock.get("/api/v1/namespaces/spring-k8s/configmaps") - .willReturn(WireMock.aResponse().withStatus(200).withBody(new JSON().serialize(allConfigMaps)))); + .willReturn(WireMock.aResponse().withStatus(200).withBody(JSON.serialize(allConfigMaps)))); } } diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/SourcesOrderConfigurationStub.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/SourcesOrderConfigurationStub.java index 61f6a89cac..537ea03827 100644 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/SourcesOrderConfigurationStub.java +++ b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/bootstrap/stubs/SourcesOrderConfigurationStub.java @@ -83,7 +83,7 @@ public static void stubConfigMapData() { // the actual stub for CoreV1Api calls WireMock.stubFor(WireMock.get("/api/v1/namespaces/spring-k8s/configmaps") - .willReturn(WireMock.aResponse().withStatus(200).withBody(new JSON().serialize(allConfigMaps)))); + .willReturn(WireMock.aResponse().withStatus(200).withBody(JSON.serialize(allConfigMaps)))); } public static void stubSecretsData() { @@ -105,7 +105,7 @@ public static void stubSecretsData() { // the actual stub for CoreV1Api calls WireMock.stubFor(WireMock.get("/api/v1/namespaces/spring-k8s/secrets") - .willReturn(WireMock.aResponse().withStatus(200).withBody(new JSON().serialize(allConfigMaps)))); + .willReturn(WireMock.aResponse().withStatus(200).withBody(JSON.serialize(allConfigMaps)))); } } diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigFailFastDisabled.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigFailFastDisabled.java index d745e9a35a..b4aad20a23 100644 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigFailFastDisabled.java +++ b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigFailFastDisabled.java @@ -68,7 +68,7 @@ static void setup() { private static void stubConfigMapAndSecretsDefaults() { // return empty config map / secret list to not fail context creation - stubFor(get(API).willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(new V1ConfigMapList())))); + stubFor(get(API).willReturn(aResponse().withStatus(200).withBody(JSON.serialize(new V1ConfigMapList())))); } @AfterAll diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigFailFastEnabledButRetryDisabled.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigFailFastEnabledButRetryDisabled.java index fd3568396a..3cfd749fcc 100644 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigFailFastEnabledButRetryDisabled.java +++ b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigFailFastEnabledButRetryDisabled.java @@ -74,7 +74,7 @@ static void setup() { private static void stubConfigMapAndSecretsDefaults() { // return empty config map / secret list to not fail context creation - stubFor(get(API).willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(new V1ConfigMapList())))); + stubFor(get(API).willReturn(aResponse().withStatus(200).withBody(JSON.serialize(new V1ConfigMapList())))); } @AfterAll diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigMapEnableRetryWithoutFailFastTest.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigMapEnableRetryWithoutFailFastTest.java index 8a4e8ba5c1..e6cf8e2462 100644 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigMapEnableRetryWithoutFailFastTest.java +++ b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigMapEnableRetryWithoutFailFastTest.java @@ -85,9 +85,9 @@ public static void setup() { private static void stubConfigMapAndSecretsDefaults() { // return empty config map / secret list to not fail context creation - stubFor(get(API).willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(new V1ConfigMapList())))); + stubFor(get(API).willReturn(aResponse().withStatus(200).withBody(JSON.serialize(new V1ConfigMapList())))); stubFor(get(SECRETS_API) - .willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(new V1SecretList())))); + .willReturn(aResponse().withStatus(200).withBody(JSON.serialize(new V1SecretList())))); } @AfterAll diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigRetryDisabledButSecretsRetryEnabled.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigRetryDisabledButSecretsRetryEnabled.java index 6ca9b33fe7..28d7309b80 100644 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigRetryDisabledButSecretsRetryEnabled.java +++ b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigRetryDisabledButSecretsRetryEnabled.java @@ -76,9 +76,9 @@ static void setup() { private static void stubConfigMapAndSecretsDefaults() { // return empty config map / secret list to not fail context creation - stubFor(get(API).willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(new V1ConfigMapList())))); + stubFor(get(API).willReturn(aResponse().withStatus(200).withBody(JSON.serialize(new V1ConfigMapList())))); stubFor(get(SECRETS_API) - .willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(new V1SecretList())))); + .willReturn(aResponse().withStatus(200).withBody(JSON.serialize(new V1SecretList())))); } @AfterAll diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigRetryEnabled.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigRetryEnabled.java index 0d0121f9eb..587092135c 100644 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigRetryEnabled.java +++ b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/configmap_retry/ConfigRetryEnabled.java @@ -80,7 +80,7 @@ static void setup() { private static void stubConfigMapAndSecretsDefaults() { // return empty config map / secret list to not fail context creation - stubFor(get(API).willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(new V1ConfigMapList())))); + stubFor(get(API).willReturn(aResponse().withStatus(200).withBody(JSON.serialize(new V1ConfigMapList())))); } @AfterAll @@ -108,7 +108,7 @@ void locateShouldNotRetryWhenThereIsNoFailure() { V1ConfigMapList configMapList = new V1ConfigMapList() .addItemsItem(new V1ConfigMap().metadata(new V1ObjectMeta().name("application")).data(data)); - stubFor(get(API).willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(configMapList)))); + stubFor(get(API).willReturn(aResponse().withStatus(200).withBody(JSON.serialize(configMapList)))); PropertySource[] propertySource = new PropertySource[1]; Assertions.assertThatCode(() -> propertySource[0] = propertySourceLocator.locate(new MockEnvironment())) @@ -151,7 +151,7 @@ void locateShouldRetryAndRecover() { // then succeed stubFor(get(API).inScenario("Retry and Recover") .whenScenarioStateIs("Failed thrice") - .willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(configMapList)))); + .willReturn(aResponse().withStatus(200).withBody(JSON.serialize(configMapList)))); PropertySource[] propertySource = new PropertySource[1]; Assertions.assertThatCode(() -> propertySource[0] = propertySourceLocator.locate(new MockEnvironment())) diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload/KubernetesClientEventBasedConfigMapChangeDetectorTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload/KubernetesClientEventBasedConfigMapChangeDetectorTests.java index 45c23b15c0..fae94af4f7 100644 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload/KubernetesClientEventBasedConfigMapChangeDetectorTests.java +++ b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload/KubernetesClientEventBasedConfigMapChangeDetectorTests.java @@ -124,14 +124,14 @@ void watch() { stubFor(get(urlMatching("^/api/v1/namespaces/default/configmaps.*")).inScenario("watch") .whenScenarioStateIs("update") .withQueryParam("watch", equalTo("true")) - .willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(watchResponse))) + .willReturn(aResponse().withStatus(200).withBody(JSON.serialize(watchResponse))) .willSetStateTo("add")); stubFor(get(urlMatching("^/api/v1/namespaces/default/configmaps.*")).inScenario("watch") .whenScenarioStateIs("add") .withQueryParam("watch", equalTo("true")) .willReturn(aResponse().withStatus(200) - .withBody(new JSON().serialize(new Watch.Response<>(EventType.ADDED.name(), + .withBody(JSON.serialize(new Watch.Response<>(EventType.ADDED.name(), new V1ConfigMap().kind("ConfigMap") .metadata(new V1ObjectMeta().namespace("default").name("bar3")) .putDataItem(Constants.APPLICATION_PROPERTIES, "debug=true"))))) @@ -141,7 +141,7 @@ void watch() { .whenScenarioStateIs("delete") .withQueryParam("watch", equalTo("true")) .willReturn(aResponse().withStatus(200) - .withBody(new JSON().serialize(new Watch.Response<>(EventType.DELETED.name(), + .withBody(JSON.serialize(new Watch.Response<>(EventType.DELETED.name(), new V1ConfigMap().kind("ConfigMap") .metadata(new V1ObjectMeta().namespace("default").name("bar1")) .putDataItem(Constants.APPLICATION_PROPERTIES, "debug=true"))))) diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload/KubernetesClientEventBasedSecretsChangeDetectorTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload/KubernetesClientEventBasedSecretsChangeDetectorTests.java index 690874c30b..ca9a796499 100644 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload/KubernetesClientEventBasedSecretsChangeDetectorTests.java +++ b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload/KubernetesClientEventBasedSecretsChangeDetectorTests.java @@ -113,20 +113,20 @@ void watch() { stubFor(get(urlMatching("/api/v1/namespaces/default/secrets.*")).inScenario(SCENARIO) .whenScenarioStateIs(STARTED) .withQueryParams(WATCH_FALSE) - .willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(secretList))) + .willReturn(aResponse().withStatus(200).withBody(JSON.serialize(secretList))) .willSetStateTo("update")); stubFor(get(urlMatching("/api/v1/namespaces/default/secrets.*")).inScenario(SCENARIO) .whenScenarioStateIs("update") .withQueryParams(WATCH_TRUE) - .willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(watchResponse))) + .willReturn(aResponse().withStatus(200).withBody(JSON.serialize(watchResponse))) .willSetStateTo("add")); stubFor(get(urlMatching("/api/v1/namespaces/default/secrets.*")).inScenario(SCENARIO) .whenScenarioStateIs("add") .withQueryParams(WATCH_TRUE) .willReturn(aResponse().withStatus(200) - .withBody(new JSON().serialize(new Watch.Response<>(EventType.ADDED.name(), + .withBody(JSON.serialize(new Watch.Response<>(EventType.ADDED.name(), new V1Secret().metadata(new V1ObjectMeta().name("rabbit-password")) .putDataItem("rabbit-pw", Base64.getEncoder().encode("password".getBytes())))))) .willSetStateTo("delete")); @@ -135,7 +135,7 @@ void watch() { .whenScenarioStateIs("delete") .withQueryParams(WATCH_TRUE) .willReturn(aResponse().withStatus(200) - .withBody(new JSON().serialize(new Watch.Response<>(EventType.DELETED.name(), + .withBody(JSON.serialize(new Watch.Response<>(EventType.DELETED.name(), new V1Secret().metadata(new V1ObjectMeta().name("rabbit-password")) .putDataItem("rabbit-pw", Base64.getEncoder().encode("password".getBytes())))))) .willSetStateTo("done")); diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload_it/EventReloadConfigMapTest.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload_it/EventReloadConfigMapTest.java index 63b8237b06..9dd8a9d100 100644 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload_it/EventReloadConfigMapTest.java +++ b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload_it/EventReloadConfigMapTest.java @@ -163,7 +163,7 @@ void test(CapturedOutput output) { // second call passes (change data so that reload is triggered) V1ConfigMap configMap = configMap(CONFIG_MAP_NAME, Map.of("a", "b")); V1ConfigMapList configMapList = new V1ConfigMapList().addItemsItem(configMap); - stubFor(get(PATH).willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(configMapList))) + stubFor(get(PATH).willReturn(aResponse().withStatus(200).withBody(JSON.serialize(configMapList))) .inScenario(SCENARIO_NAME) .whenScenarioStateIs("go-to-ok") .willSetStateTo("done")); @@ -205,7 +205,7 @@ AbstractEnvironment environment() { // needed so that our environment is populated with 'something' // this call is done in the method that returns the AbstractEnvironment - stubFor(get(PATH).willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(configMapList))) + stubFor(get(PATH).willReturn(aResponse().withStatus(200).withBody(JSON.serialize(configMapList))) .inScenario(SCENARIO_NAME) .whenScenarioStateIs(Scenario.STARTED) .willSetStateTo("go-to-fail")); diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload_it/EventReloadSecretTest.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload_it/EventReloadSecretTest.java index 02e8fb9f16..c50e38b53c 100644 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload_it/EventReloadSecretTest.java +++ b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload_it/EventReloadSecretTest.java @@ -164,7 +164,7 @@ void test(CapturedOutput output) { // second call passes (change data so that reload is triggered) V1Secret secret = secret(SECRET_NAME, Map.of("a", "b")); V1SecretList secretList = new V1SecretList().addItemsItem(secret); - stubFor(get(PATH).willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(secretList))) + stubFor(get(PATH).willReturn(aResponse().withStatus(200).withBody(JSON.serialize(secretList))) .inScenario(SCENARIO_NAME) .whenScenarioStateIs("go-to-ok") .willSetStateTo("done")); diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload_it/PollingReloadConfigMapTest.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload_it/PollingReloadConfigMapTest.java index 70fbc8106e..528ba39fd9 100644 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload_it/PollingReloadConfigMapTest.java +++ b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload_it/PollingReloadConfigMapTest.java @@ -139,7 +139,7 @@ void test(CapturedOutput output) { // second reload call passes V1ConfigMap configMapTwo = configMap(CONFIG_MAP_NAME, Map.of("a", "b")); V1ConfigMapList listTwo = new V1ConfigMapList().addItemsItem(configMapTwo); - stubFor(get(PATH).willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(listTwo))) + stubFor(get(PATH).willReturn(aResponse().withStatus(200).withBody(JSON.serialize(listTwo))) .inScenario(SCENARIO_NAME) .whenScenarioStateIs("go-to-ok") .willSetStateTo("done")); @@ -181,7 +181,7 @@ AbstractEnvironment environment() { // needed so that our environment is populated with 'something' // this call is done in the method that returns the AbstractEnvironment - stubFor(get(PATH).willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(listOne))) + stubFor(get(PATH).willReturn(aResponse().withStatus(200).withBody(JSON.serialize(listOne))) .inScenario(SCENARIO_NAME) .whenScenarioStateIs(Scenario.STARTED) .willSetStateTo("go-to-fail")); diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload_it/PollingReloadSecretTest.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload_it/PollingReloadSecretTest.java index f150c0515f..43d489c3b6 100644 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload_it/PollingReloadSecretTest.java +++ b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/reload_it/PollingReloadSecretTest.java @@ -138,7 +138,7 @@ void test(CapturedOutput output) { V1Secret secretTwo = secret(SECRET_NAME, Map.of("a", "b")); V1SecretList listTwo = new V1SecretList().addItemsItem(secretTwo); - stubFor(get(PATH).willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(listTwo))) + stubFor(get(PATH).willReturn(aResponse().withStatus(200).withBody(JSON.serialize(listTwo))) .inScenario(SCENARIO_NAME) .willSetStateTo("done") .whenScenarioStateIs("go-to-ok")); @@ -183,7 +183,7 @@ AbstractEnvironment environment() { // needed so that our environment is populated with 'something' // this call is done in the method that returns the AbstractEnvironment - stubFor(get(PATH).willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(listOne))) + stubFor(get(PATH).willReturn(aResponse().withStatus(200).withBody(JSON.serialize(listOne))) .inScenario(SCENARIO_NAME) .whenScenarioStateIs(Scenario.STARTED) .willSetStateTo("go-to-fail")); diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/secrets_retry/SecretsEnableRetryWithoutFailFastTest.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/secrets_retry/SecretsEnableRetryWithoutFailFastTest.java index a8b826926c..8853ca7d96 100644 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/secrets_retry/SecretsEnableRetryWithoutFailFastTest.java +++ b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/secrets_retry/SecretsEnableRetryWithoutFailFastTest.java @@ -85,9 +85,9 @@ public static void setup() { private static void stubConfigMapAndSecretsDefaults() { // return empty config map / secret list to not fail context creation - stubFor(get(API).willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(new V1ConfigMapList())))); + stubFor(get(API).willReturn(aResponse().withStatus(200).withBody(JSON.serialize(new V1ConfigMapList())))); stubFor(get(SECRETS_API) - .willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(new V1SecretList())))); + .willReturn(aResponse().withStatus(200).withBody(JSON.serialize(new V1SecretList())))); } @AfterAll diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/secrets_retry/SecretsRetryEnabledTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/secrets_retry/SecretsRetryEnabledTests.java index 5ccd856bd5..a83ffec4de 100644 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/secrets_retry/SecretsRetryEnabledTests.java +++ b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/secrets_retry/SecretsRetryEnabledTests.java @@ -115,7 +115,7 @@ void locateShouldNotRetryWhenThereIsNoFailure() { V1SecretList secretList = new V1SecretList() .addItemsItem(new V1Secret().metadata(new V1ObjectMeta().name("my-secret")).data(data)); - stubFor(get(API).willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(secretList)))); + stubFor(get(API).willReturn(aResponse().withStatus(200).withBody(JSON.serialize(secretList)))); final PropertySource[] propertySource = new PropertySource[1]; Assertions.assertThatCode(() -> propertySource[0] = propertySourceLocator.locate(new MockEnvironment())) @@ -158,7 +158,7 @@ void locateShouldRetryAndRecover() { // then succeed stubFor(get(API).inScenario("Retry and Recover") .whenScenarioStateIs("Failed thrice") - .willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(secretList)))); + .willReturn(aResponse().withStatus(200).withBody(JSON.serialize(secretList)))); final PropertySource[] propertySource = new PropertySource[1]; Assertions.assertThatNoException() diff --git a/spring-cloud-kubernetes-client-discovery/src/test/java/org/springframework/cloud/kubernetes/client/discovery/KubernetesClientConfigServerBootstrapperTests.java b/spring-cloud-kubernetes-client-discovery/src/test/java/org/springframework/cloud/kubernetes/client/discovery/KubernetesClientConfigServerBootstrapperTests.java index b7f90ad5e1..e6a2920647 100644 --- a/spring-cloud-kubernetes-client-discovery/src/test/java/org/springframework/cloud/kubernetes/client/discovery/KubernetesClientConfigServerBootstrapperTests.java +++ b/spring-cloud-kubernetes-client-discovery/src/test/java/org/springframework/cloud/kubernetes/client/discovery/KubernetesClientConfigServerBootstrapperTests.java @@ -126,11 +126,11 @@ public void before() throws JsonProcessingException { .withHeader("content-type", "application/json"))); stubFor(get("/api/v1/namespaces/default/endpoints?resourceVersion=0&watch=false") .willReturn(aResponse().withStatus(200) - .withBody(new JSON().serialize(ENDPOINTS_LIST)) + .withBody(JSON.serialize(ENDPOINTS_LIST)) .withHeader("content-type", "application/json"))); stubFor(get("/api/v1/namespaces/default/services?resourceVersion=0&watch=false") .willReturn(aResponse().withStatus(200) - .withBody(new JSON().serialize(SERVICE_LIST)) + .withBody(JSON.serialize(SERVICE_LIST)) .withHeader("content-type", "application/json"))); stubFor(get(urlMatching("/api/v1/namespaces/default/services.*.watch=true")) .willReturn(aResponse().withStatus(200))); diff --git a/spring-cloud-kubernetes-client-discovery/src/test/java/org/springframework/cloud/kubernetes/client/discovery/KubernetesClientDiscoveryClientAutoConfigurationTests.java b/spring-cloud-kubernetes-client-discovery/src/test/java/org/springframework/cloud/kubernetes/client/discovery/KubernetesClientDiscoveryClientAutoConfigurationTests.java index 6c5120e4ac..e7a64f39b8 100644 --- a/spring-cloud-kubernetes-client-discovery/src/test/java/org/springframework/cloud/kubernetes/client/discovery/KubernetesClientDiscoveryClientAutoConfigurationTests.java +++ b/spring-cloud-kubernetes-client-discovery/src/test/java/org/springframework/cloud/kubernetes/client/discovery/KubernetesClientDiscoveryClientAutoConfigurationTests.java @@ -92,12 +92,12 @@ ApiClient apiClient() { WireMock.configureFor(wireMockServer.port()); stubFor(get("/api/v1/namespaces/test/endpoints?resourceVersion=0&watch=false") .willReturn(aResponse().withStatus(200) - .withBody(new JSON().serialize(new V1EndpointsListBuilder() + .withBody(JSON.serialize(new V1EndpointsListBuilder() .withMetadata(new V1ListMetaBuilder().withResourceVersion("0").build()) .build())))); stubFor(get("/api/v1/namespaces/test/services?resourceVersion=0&watch=false") .willReturn(aResponse().withStatus(200) - .withBody(new JSON().serialize(new V1ServiceListBuilder() + .withBody(JSON.serialize(new V1ServiceListBuilder() .withMetadata(new V1ListMetaBuilder().withResourceVersion("0").build()) .build())))); return new ClientBuilder().setBasePath(wireMockServer.baseUrl()).build(); diff --git a/spring-cloud-kubernetes-client-loadbalancer/src/test/java/org/springframework/cloud/kubernetes/client/loadbalancer/KubernetesClientServicesListSupplierTests.java b/spring-cloud-kubernetes-client-loadbalancer/src/test/java/org/springframework/cloud/kubernetes/client/loadbalancer/KubernetesClientServicesListSupplierTests.java index d6ba209ec9..b58c9dc9b0 100644 --- a/spring-cloud-kubernetes-client-loadbalancer/src/test/java/org/springframework/cloud/kubernetes/client/loadbalancer/KubernetesClientServicesListSupplierTests.java +++ b/spring-cloud-kubernetes-client-loadbalancer/src/test/java/org/springframework/cloud/kubernetes/client/loadbalancer/KubernetesClientServicesListSupplierTests.java @@ -143,7 +143,7 @@ void singleNamespaceTest(CapturedOutput output) { discoveryProperties, coreV1Api, kubernetesNamespaceProvider); stubFor(get(urlEqualTo("/api/v1/namespaces/default/services?fieldSelector=metadata.name%3Dservice-a")) - .willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(SINGLE_NAMESPACE_SERVICES)))); + .willReturn(aResponse().withStatus(200).withBody(JSON.serialize(SINGLE_NAMESPACE_SERVICES)))); Flux> instances = listSupplier.get(); @@ -211,7 +211,7 @@ void allNamespacesTest(CapturedOutput output) { discoveryProperties, coreV1Api, kubernetesNamespaceProvider); stubFor(get(urlEqualTo("/api/v1/services?fieldSelector=metadata.name%3Dservice-a")) - .willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(SERVICE_LIST_ALL_NAMESPACE)))); + .willReturn(aResponse().withStatus(200).withBody(JSON.serialize(SERVICE_LIST_ALL_NAMESPACE)))); Flux> instances = listSupplier.get(); @@ -250,11 +250,11 @@ void selectiveNamespacesTest(CapturedOutput output) { stubFor(get(urlEqualTo("/api/v1/namespaces/default/services?fieldSelector=metadata.name%3Dservice-a")) .willReturn(aResponse().withStatus(200) - .withBody(new JSON().serialize(SERVICE_A_DEFAULT_NAMESPACE_SELECTIVE_NAMESPACES)))); + .withBody(JSON.serialize(SERVICE_A_DEFAULT_NAMESPACE_SELECTIVE_NAMESPACES)))); stubFor(get(urlEqualTo("/api/v1/namespaces/test/services?fieldSelector=metadata.name%3Dservice-a")) .willReturn(aResponse().withStatus(200) - .withBody(new JSON().serialize(SERVICE_A_TEST_NAMESPACE_SELECTIVE_NAMESPACES)))); + .withBody(JSON.serialize(SERVICE_A_TEST_NAMESPACE_SELECTIVE_NAMESPACES)))); stubFor(get(urlEqualTo("/api/v1/namespaces/no-service/services?fieldSelector=metadata.name%3Dservice-a")) .willReturn(aResponse().withStatus(404))); diff --git a/spring-cloud-kubernetes-client-loadbalancer/src/test/java/org/springframework/cloud/kubernetes/client/loadbalancer/it/Util.java b/spring-cloud-kubernetes-client-loadbalancer/src/test/java/org/springframework/cloud/kubernetes/client/loadbalancer/it/Util.java index fa36747b37..87454c9b4d 100644 --- a/spring-cloud-kubernetes-client-loadbalancer/src/test/java/org/springframework/cloud/kubernetes/client/loadbalancer/it/Util.java +++ b/spring-cloud-kubernetes-client-loadbalancer/src/test/java/org/springframework/cloud/kubernetes/client/loadbalancer/it/Util.java @@ -66,7 +66,7 @@ public static V1Endpoints endpoints(String namespace, String name, int port, Str public static void servicesPodMode(WireMockServer server, V1ServiceList serviceList) { server.stubFor(WireMock.get(WireMock.urlPathMatching("^/api/v1/services*")) - .willReturn(WireMock.aResponse().withBody(new JSON().serialize(serviceList)).withStatus(200))); + .willReturn(WireMock.aResponse().withBody(JSON.serialize(serviceList)).withStatus(200))); } public static void servicesServiceMode(WireMockServer server, V1ServiceList serviceList, String serviceName) { @@ -74,16 +74,16 @@ public static void servicesServiceMode(WireMockServer server, V1ServiceList serv // 'postConstruct' in the KubernetesInformerDiscoveryClient server.stubFor(WireMock.get(WireMock.urlPathMatching("^/api/v1/services*")) .withQueryParam("resourceVersion", WireMock.equalTo("0")) - .willReturn(WireMock.aResponse().withBody(new JSON().serialize(serviceList)).withStatus(200))); + .willReturn(WireMock.aResponse().withBody(JSON.serialize(serviceList)).withStatus(200))); server .stubFor(WireMock.get(WireMock.urlEqualTo("/api/v1/services?fieldSelector=metadata.name%3D" + serviceName)) - .willReturn(WireMock.aResponse().withBody(new JSON().serialize(serviceList)).withStatus(200))); + .willReturn(WireMock.aResponse().withBody(JSON.serialize(serviceList)).withStatus(200))); } public static void endpointsPodMode(WireMockServer server, V1EndpointsList endpointsList) { server.stubFor(WireMock.get(WireMock.urlPathMatching("^/api/v1/endpoints*")) - .willReturn(WireMock.aResponse().withBody(new JSON().serialize(endpointsList)).withStatus(200))); + .willReturn(WireMock.aResponse().withBody(JSON.serialize(endpointsList)).withStatus(200))); } public static void endpointsServiceMode(WireMockServer server, V1EndpointsList endpointsList, @@ -92,16 +92,16 @@ public static void endpointsServiceMode(WireMockServer server, V1EndpointsList e // 'postConstruct' in the KubernetesInformerDiscoveryClient server.stubFor(WireMock.get(WireMock.urlPathMatching("^/api/v1/endpoints*")) .withQueryParam("resourceVersion", WireMock.equalTo("0")) - .willReturn(WireMock.aResponse().withBody(new JSON().serialize(endpointsList)).withStatus(200))); + .willReturn(WireMock.aResponse().withBody(JSON.serialize(endpointsList)).withStatus(200))); server.stubFor( WireMock.get(WireMock.urlEqualTo("/api/v1/endpoints?fieldSelector=metadata.name%3D" + endpointsName)) - .willReturn(WireMock.aResponse().withBody(new JSON().serialize(endpointsList)).withStatus(200))); + .willReturn(WireMock.aResponse().withBody(JSON.serialize(endpointsList)).withStatus(200))); } public static void servicesInNamespacePodMode(WireMockServer server, V1ServiceList serviceList, String namespace) { server.stubFor(WireMock.get(WireMock.urlPathMatching("^/api/v1/namespaces/" + namespace + "/services*")) - .willReturn(WireMock.aResponse().withBody(new JSON().serialize(serviceList)).withStatus(200))); + .willReturn(WireMock.aResponse().withBody(JSON.serialize(serviceList)).withStatus(200))); } public static void servicesInNamespaceServiceMode(WireMockServer server, V1ServiceList serviceList, @@ -110,18 +110,18 @@ public static void servicesInNamespaceServiceMode(WireMockServer server, V1Servi // 'postConstruct' in the KubernetesInformerDiscoveryClient server.stubFor(WireMock.get(WireMock.urlPathMatching("^/api/v1/namespaces/" + namespace + "/services*")) .withQueryParam("resourceVersion", WireMock.equalTo("0")) - .willReturn(WireMock.aResponse().withBody(new JSON().serialize(serviceList)).withStatus(200))); + .willReturn(WireMock.aResponse().withBody(JSON.serialize(serviceList)).withStatus(200))); server.stubFor(WireMock .get(WireMock.urlEqualTo( "/api/v1/namespaces/" + namespace + "/services?fieldSelector=metadata.name%3D" + serviceName)) - .willReturn(WireMock.aResponse().withBody(new JSON().serialize(serviceList)).withStatus(200))); + .willReturn(WireMock.aResponse().withBody(JSON.serialize(serviceList)).withStatus(200))); } public static void endpointsInNamespacePodMode(WireMockServer server, V1EndpointsList endpointsList, String namespace) { server.stubFor(WireMock.get(WireMock.urlPathMatching("^/api/v1/namespaces/" + namespace + "/endpoints*")) - .willReturn(WireMock.aResponse().withBody(new JSON().serialize(endpointsList)).withStatus(200))); + .willReturn(WireMock.aResponse().withBody(JSON.serialize(endpointsList)).withStatus(200))); } public static void endpointsInNamespaceServiceMode(WireMockServer server, V1EndpointsList endpointsList, @@ -130,12 +130,12 @@ public static void endpointsInNamespaceServiceMode(WireMockServer server, V1Endp // 'postConstruct' in the KubernetesInformerDiscoveryClient server.stubFor(WireMock.get(WireMock.urlPathMatching("^/api/v1/namespaces/" + namespace + "/endpoints*")) .withQueryParam("resourceVersion", WireMock.equalTo("0")) - .willReturn(WireMock.aResponse().withBody(new JSON().serialize(endpointsList)).withStatus(200))); + .willReturn(WireMock.aResponse().withBody(JSON.serialize(endpointsList)).withStatus(200))); server.stubFor(WireMock .get(WireMock.urlEqualTo( "/api/v1/namespaces/" + namespace + "/endpoints?fieldSelector=metadata.name%3D" + endpointsName)) - .willReturn(WireMock.aResponse().withBody(new JSON().serialize(endpointsList)).withStatus(200))); + .willReturn(WireMock.aResponse().withBody(JSON.serialize(endpointsList)).withStatus(200))); } public static void mockWatchers(WireMockServer wireMockServer) { diff --git a/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/src/test/java/org/springframework/cloud/kubernetes/configserver/configurations/SecondConfig.java b/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/src/test/java/org/springframework/cloud/kubernetes/configserver/configurations/SecondConfig.java index 1a4e76acb1..b5f60426cb 100644 --- a/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/src/test/java/org/springframework/cloud/kubernetes/configserver/configurations/SecondConfig.java +++ b/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/src/test/java/org/springframework/cloud/kubernetes/configserver/configurations/SecondConfig.java @@ -73,10 +73,10 @@ WireMockServer wireMockServer() { WireMock.configureFor(wireMockServer.port()); WireMock.stubFor(get(urlMatching("^/api/v1/namespaces/default/configmaps.*")) - .willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(CONFIGMAP_DEFAULT_LIST)))); + .willReturn(aResponse().withStatus(200).withBody(JSON.serialize(CONFIGMAP_DEFAULT_LIST)))); WireMock.stubFor(get(urlMatching("^/api/v1/namespaces/default/secrets.*")) - .willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(SECRET_DEFAULT_LIST)))); + .willReturn(aResponse().withStatus(200).withBody(JSON.serialize(SECRET_DEFAULT_LIST)))); return wireMockServer; }