diff --git a/java-generator/it/src/it/ignore-unknown-toplevel-objects/src/test/java/io/fabric8/it/top/TestIgnoreUnknownTopleveObjsFromConfig.java b/java-generator/it/src/it/ignore-unknown-toplevel-objects/src/test/java/io/fabric8/it/top/TestIgnoreUnknownTopleveObjsFromConfig.java index 68b0038a634..0ffcfc1eb50 100644 --- a/java-generator/it/src/it/ignore-unknown-toplevel-objects/src/test/java/io/fabric8/it/top/TestIgnoreUnknownTopleveObjsFromConfig.java +++ b/java-generator/it/src/it/ignore-unknown-toplevel-objects/src/test/java/io/fabric8/it/top/TestIgnoreUnknownTopleveObjsFromConfig.java @@ -16,21 +16,17 @@ package io.fabric8.it.top; import com.fasterxml.jackson.databind.JsonNode; -import io.fabric8.kubernetes.api.model.AnyType; -import io.fabric8.kubernetes.api.model.ObjectMeta; -import io.fabric8.kubernetes.client.utils.Serialization; -import org.junit.jupiter.api.Test; -import io.fabric8.java.generator.testing.KubernetesResourceDiff; import io.argoproj.v1alpha1.Application; import io.argoproj.v1alpha1.ApplicationSpec; import io.argoproj.v1alpha1.applicationspec.Destination; +import io.fabric8.java.generator.testing.KubernetesResourceDiff; +import io.fabric8.kubernetes.api.model.ObjectMeta; +import io.fabric8.kubernetes.client.utils.Serialization; +import org.junit.jupiter.api.Test; +import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.nio.file.Files; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; import java.util.List; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -43,9 +39,9 @@ void testDeserialization() { try { Application.class.getMethod("getAdditionalProperties"); fail("No getAdditionalProperties method expected"); - } catch (NoSuchMethodException e) { + } catch (NoSuchMethodException e) { e.printStackTrace(); - } + } } private Application createSampleApplicationNoAdditionalFields(String name) throws Exception { @@ -74,7 +70,7 @@ void testAgainstSampleNoAdditionalFields() throws Exception { // Act List aggregatedDiffs = diff.getListOfDiffs(); - + // Assert assertEquals(0, aggregatedDiffs.size()); } @@ -89,7 +85,7 @@ void testAgainstSampleWithAdditionalFields() throws Exception { // Act List aggregatedDiffs = diff.getListOfDiffs(); - + // Assert // We expect 6 additional fields that are not available in the sample object assertEquals(6, aggregatedDiffs.size()); diff --git a/java-generator/it/src/it/ignore-unknown-toplevel-objects/src/test/java/io/fabric8/it/top/TestToplevelFields.java b/java-generator/it/src/it/ignore-unknown-toplevel-objects/src/test/java/io/fabric8/it/top/TestToplevelFields.java index c00014eed56..974a0692398 100644 --- a/java-generator/it/src/it/ignore-unknown-toplevel-objects/src/test/java/io/fabric8/it/top/TestToplevelFields.java +++ b/java-generator/it/src/it/ignore-unknown-toplevel-objects/src/test/java/io/fabric8/it/top/TestToplevelFields.java @@ -16,23 +16,22 @@ package io.fabric8.it.top; import com.fasterxml.jackson.databind.JsonNode; +import io.argoproj.v1alpha1.Application; +import io.argoproj.v1alpha1.ApplicationSpec; +import io.argoproj.v1alpha1.application.Operation; +import io.argoproj.v1alpha1.application.operation.InitiatedBy; +import io.argoproj.v1alpha1.applicationspec.Destination; +import io.fabric8.java.generator.testing.KubernetesResourceDiff; import io.fabric8.kubernetes.api.model.ObjectMeta; import io.fabric8.kubernetes.client.utils.Serialization; import org.junit.jupiter.api.Test; -import io.fabric8.java.generator.testing.KubernetesResourceDiff; +import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.nio.file.Files; import java.util.List; -import io.argoproj.v1alpha1.Application; -import io.argoproj.v1alpha1.ApplicationSpec; -import io.argoproj.v1alpha1.applicationspec.Destination; -import io.argoproj.v1alpha1.application.Operation; -import io.argoproj.v1alpha1.application.operation.InitiatedBy; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.fail; class TestToplevelFields { @@ -56,6 +55,7 @@ private Application createSampleApplication() throws Exception { application.setOperation(op); return application; } + @Test void testAgainstSample() throws Exception { // Arrange diff --git a/java-generator/it/src/it/preserve-unknown-toplevel-objects/src/test/java/io/fabric8/it/top/TestPreserveUnknownToplevelObjectsFromConfig.java b/java-generator/it/src/it/preserve-unknown-toplevel-objects/src/test/java/io/fabric8/it/top/TestPreserveUnknownToplevelObjectsFromConfig.java index c2c6e0dbbaa..037c1ea26d2 100644 --- a/java-generator/it/src/it/preserve-unknown-toplevel-objects/src/test/java/io/fabric8/it/top/TestPreserveUnknownToplevelObjectsFromConfig.java +++ b/java-generator/it/src/it/preserve-unknown-toplevel-objects/src/test/java/io/fabric8/it/top/TestPreserveUnknownToplevelObjectsFromConfig.java @@ -16,22 +16,21 @@ package io.fabric8.it.top; import com.fasterxml.jackson.databind.JsonNode; +import io.argoproj.v1alpha1.Application; +import io.argoproj.v1alpha1.ApplicationSpec; +import io.argoproj.v1alpha1.applicationspec.Destination; +import io.fabric8.java.generator.testing.KubernetesResourceDiff; import io.fabric8.kubernetes.api.model.AnyType; import io.fabric8.kubernetes.api.model.ObjectMeta; import io.fabric8.kubernetes.client.utils.Serialization; import org.junit.jupiter.api.Test; -import io.fabric8.java.generator.testing.KubernetesResourceDiff; -import io.argoproj.v1alpha1.Application; -import io.argoproj.v1alpha1.ApplicationSpec; -import io.argoproj.v1alpha1.applicationspec.Destination; +import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.nio.file.Files; -import java.util.ArrayList; import java.util.HashMap; -import java.util.Map; import java.util.List; +import java.util.Map; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -40,8 +39,7 @@ class TestPreserveUnknownToplevelObjectsFromConfig { @Test void testDeserialization() { // Arrange - Application sample = - Serialization.unmarshal(getClass().getResourceAsStream("/sample-addprops.yaml"), Application.class); + Application sample = Serialization.unmarshal(getClass().getResourceAsStream("/sample-addprops.yaml"), Application.class); // Assert assertEquals(5, sample.getAdditionalProperties().size()); } @@ -62,8 +60,8 @@ private Application createSampleApplicationAdditionalFields() throws Exception { application.setAdditionalProperty("consumerID", new AnyType("{uuid}")); application.setAdditionalProperty("url", new AnyType("tcp://admin:public@localhost:1883")); application.setAdditionalProperty("qos", new AnyType(1)); - application.setAdditionalProperty("anArray", new AnyType(new int[]{1, 2, 3})); - + application.setAdditionalProperty("anArray", new AnyType(new int[] { 1, 2, 3 })); + Map obj = new HashMap(); obj.put("ONE", 1); obj.put("TWO", 2); diff --git a/java-generator/it/src/it/preserve-unknown-toplevel-objects/src/test/java/io/fabric8/it/top/TestToplevelFields.java b/java-generator/it/src/it/preserve-unknown-toplevel-objects/src/test/java/io/fabric8/it/top/TestToplevelFields.java index 031da3180da..fe6d2d3dc41 100644 --- a/java-generator/it/src/it/preserve-unknown-toplevel-objects/src/test/java/io/fabric8/it/top/TestToplevelFields.java +++ b/java-generator/it/src/it/preserve-unknown-toplevel-objects/src/test/java/io/fabric8/it/top/TestToplevelFields.java @@ -16,31 +16,30 @@ package io.fabric8.it.dummy; import com.fasterxml.jackson.databind.JsonNode; +import io.argoproj.v1alpha1.Application; +import io.argoproj.v1alpha1.ApplicationSpec; +import io.argoproj.v1alpha1.application.Operation; +import io.argoproj.v1alpha1.application.operation.InitiatedBy; +import io.argoproj.v1alpha1.applicationspec.Destination; +import io.fabric8.java.generator.testing.KubernetesResourceDiff; import io.fabric8.kubernetes.api.model.ObjectMeta; import io.fabric8.kubernetes.client.utils.Serialization; import org.junit.jupiter.api.Test; -import io.fabric8.java.generator.testing.KubernetesResourceDiff; +import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.nio.file.Files; import java.util.List; -import io.argoproj.v1alpha1.Application; -import io.argoproj.v1alpha1.ApplicationSpec; -import io.argoproj.v1alpha1.applicationspec.Destination; -import io.argoproj.v1alpha1.application.Operation; -import io.argoproj.v1alpha1.application.operation.InitiatedBy; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.fail; class TestToplevelFields { @Test void testDeserialization() { // Arrange - Application sample = - Serialization.unmarshal(getClass().getResourceAsStream("/sample-tl-operation.yaml"), Application.class); + Application sample = Serialization.unmarshal(getClass().getResourceAsStream("/sample-tl-operation.yaml"), + Application.class); // Assert assertEquals(0, sample.getAdditionalProperties().size()); } @@ -65,6 +64,7 @@ private Application createSampleApplication() throws Exception { application.setOperation(op); return application; } + @Test void testAgainstSample() throws Exception { // Arrange