Skip to content

Commit

Permalink
refactor(styles): run spotless on the it/test folders (6321)
Browse files Browse the repository at this point in the history
use spotless on the it/test folders
---
apply spotless to the it/tests folders
  • Loading branch information
andreaTP authored Sep 3, 2024
1 parent ecd0af0 commit dbd22cd
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,17 @@
*/
package io.fabric8.it.datetime;

import com.fasterxml.jackson.databind.JsonNode;
import com.example.v1.Dummy;
import com.example.v1.DummySpec;
import com.fasterxml.jackson.databind.JsonNode;
import io.fabric8.java.generator.testing.KubernetesResourceDiff;
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.time.format.DateTimeFormatter;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;

import static org.junit.jupiter.api.Assertions.assertEquals;
Expand All @@ -39,8 +38,7 @@ class TestSerialization {
@Test
void testDeserialization() {
// Arrange
Dummy sample =
Serialization.unmarshal(getClass().getResourceAsStream("/sample.yaml"), Dummy.class);
Dummy sample = Serialization.unmarshal(getClass().getResourceAsStream("/sample.yaml"), Dummy.class);

// Act
ZonedDateTime datetime = sample.getSpec().getMydatetime();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@
*/
package io.fabric8.it.certmanager;

import com.fasterxml.jackson.databind.JsonNode;
import io.cert_manager.v1.CertificateRequest;
import io.cert_manager.v1.certificaterequestspec.Ten;
import io.fabric8.kubernetes.api.model.IntOrString;
import io.fabric8.kubernetes.client.utils.Serialization;
import org.junit.jupiter.api.Test;

import java.time.format.DateTimeFormatter;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;

import static io.cert_manager.v1.CertificateRequestSpec.*;
Expand All @@ -36,8 +35,7 @@ class TestDefaultValues {
@Test
void testDefaultValues() throws Exception {
// Arrange
CertificateRequest cr =
Serialization.unmarshal(getClass().getResourceAsStream("/empty.yaml"), CertificateRequest.class);
CertificateRequest cr = Serialization.unmarshal(getClass().getResourceAsStream("/empty.yaml"), CertificateRequest.class);

// Act
String one = cr.getSpec().getOne();
Expand All @@ -62,7 +60,7 @@ void testDefaultValues() throws Exception {
assertEquals(3, three);
assertEquals(4L, four);
assertEquals(5L, five);
assertEquals(6,1f, six);
assertEquals(6, 1f, six);
assertEquals(7.2d, seven);
assertEquals(8.2d, eight);
assertEquals(2, nine.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@
*/
package io.fabric8.it.dummy;

import com.fasterxml.jackson.databind.JsonNode;
import com.example.v1.Dummy;
import com.example.v1.DummySpec;
import com.example.v1.dummyspec.Package;
import com.example.v1.dummyspec.package_.Foo;
import com.fasterxml.jackson.databind.JsonNode;
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 static org.junit.jupiter.api.Assertions.assertEquals;
Expand All @@ -37,8 +37,7 @@ class TestEscapeCharacters {
@Test
void testDeserialization() {
// Arrange
Dummy sample =
Serialization.unmarshal(getClass().getResourceAsStream("/sample.yaml"), Dummy.class);
Dummy sample = Serialization.unmarshal(getClass().getResourceAsStream("/sample.yaml"), Dummy.class);

// Act
DummySpec spec = sample.getSpec();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@
import io.dapr.v1alpha1.Component;
import io.dapr.v1alpha1.ComponentSpec;
import io.dapr.v1alpha1.componentspec.Metadata;
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 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;

Expand All @@ -40,8 +40,7 @@ class TestPreserveUnknownUsabilityFromConfig {
@Test
void testDeserialization() {
// Arrange
Component sample =
Serialization.unmarshal(getClass().getResourceAsStream("/sample.yaml"), Component.class);
Component sample = Serialization.unmarshal(getClass().getResourceAsStream("/sample.yaml"), Component.class);

// Act
List<Metadata> metadataList = sample.getSpec().getMetadata();
Expand All @@ -66,7 +65,7 @@ private Component createSampleComponent() throws Exception {
meta3.setAdditionalProperty("qos", new AnyType(1));

Metadata meta4 = new Metadata();
meta4.setAdditionalProperty("anArray", new AnyType(new int[]{1, 2, 3}));
meta4.setAdditionalProperty("anArray", new AnyType(new int[] { 1, 2, 3 }));

Metadata meta5 = new Metadata();
Map<String, Object> obj = new HashMap();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@
import io.dapr.v1alpha1.Component;
import io.dapr.v1alpha1.ComponentSpec;
import io.dapr.v1alpha1.componentspec.Metadata;
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 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;

Expand All @@ -40,8 +40,7 @@ class TestPreserveUnknownUsability {
@Test
void testDeserialization() {
// Arrange
Component sample =
Serialization.unmarshal(getClass().getResourceAsStream("/sample.yaml"), Component.class);
Component sample = Serialization.unmarshal(getClass().getResourceAsStream("/sample.yaml"), Component.class);

// Act
List<Metadata> metadataList = sample.getSpec().getMetadata();
Expand Down Expand Up @@ -70,7 +69,7 @@ private Component createSampleComponent() throws Exception {

Metadata meta4 = new Metadata();
meta4.setName("anArray");
meta4.setValue(new AnyType(new int[]{1, 2, 3}));
meta4.setValue(new AnyType(new int[] { 1, 2, 3 }));

Metadata meta5 = new Metadata();
meta5.setName("anObject");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,17 @@
import com.fasterxml.jackson.databind.JsonNode;
import io.dapr.v1alpha1.Component;
import io.dapr.v1alpha1.ComponentSpec;
import io.fabric8.kubernetes.api.model.AnyType;
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.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;

Expand All @@ -39,8 +37,7 @@ class TestPreserveUnknownSerDeser {
@Test
void testDeserialization() {
// Arrange
Component sample =
Serialization.unmarshal(getClass().getResourceAsStream("/sample.yaml"), Component.class);
Component sample = Serialization.unmarshal(getClass().getResourceAsStream("/sample.yaml"), Component.class);

// Act
Map<String, Object> testObj = sample.getSpec().getTest().getAdditionalProperties();
Expand All @@ -62,7 +59,7 @@ private Component createSampleComponent() throws Exception {
twoContent.put("more", 1);
twoContent.put("complex", true);
t.setAdditionalProperty("two", twoContent);

spec.setTest(t);

component.setSpec(spec);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
import io.cert_manager.v1.CertificateRequestSpec;
import io.cert_manager.v1.CertificateRequestSpec.IntEnum;
import io.cert_manager.v1.CertificateRequestSpec.LongEnum;
import io.fabric8.java.generator.testing.KubernetesResourceDiff;
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.time.format.DateTimeFormatter;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;

import static org.junit.jupiter.api.Assertions.assertEquals;
Expand All @@ -43,8 +43,8 @@ class TestSerialization {
@Test
void testDeserialization() {
// Arrange
CertificateRequest sample =
Serialization.unmarshal(getClass().getResourceAsStream("/sample1.yaml"), CertificateRequest.class);
CertificateRequest sample = Serialization.unmarshal(getClass().getResourceAsStream("/sample1.yaml"),
CertificateRequest.class);

// Act
List<CertificateRequestSpec.Usages> usagesList = sample.getSpec().getUsages();
Expand All @@ -65,12 +65,12 @@ void testDeserialization() {
@Test
void testAlternativeDateDeserialization() {
// Arrange
CertificateRequest sample2 =
Serialization.unmarshal(getClass().getResourceAsStream("/sample2.yaml"), CertificateRequest.class);
CertificateRequest sample3 =
Serialization.unmarshal(getClass().getResourceAsStream("/sample3.yaml"), CertificateRequest.class);
CertificateRequest sample4 =
Serialization.unmarshal(getClass().getResourceAsStream("/sample4.yaml"), CertificateRequest.class);
CertificateRequest sample2 = Serialization.unmarshal(getClass().getResourceAsStream("/sample2.yaml"),
CertificateRequest.class);
CertificateRequest sample3 = Serialization.unmarshal(getClass().getResourceAsStream("/sample3.yaml"),
CertificateRequest.class);
CertificateRequest sample4 = Serialization.unmarshal(getClass().getResourceAsStream("/sample4.yaml"),
CertificateRequest.class);

// Act
ZonedDateTime datetime2 = sample2.getSpec().getDatetime();
Expand All @@ -86,8 +86,8 @@ void testAlternativeDateDeserialization() {
@Test
void testNumericEnum() {
// Arrange
CertificateRequest sample8 =
Serialization.unmarshal(getClass().getResourceAsStream("/sample8.yaml"), CertificateRequest.class);
CertificateRequest sample8 = Serialization.unmarshal(getClass().getResourceAsStream("/sample8.yaml"),
CertificateRequest.class);

// Act
LongEnum longValue = sample8.getSpec().getLongEnum();
Expand All @@ -100,7 +100,7 @@ void testNumericEnum() {
assertEquals(203, intValue.getValue());
}

@Test
@Test
void testIntEnumSerDeser() throws Exception {
// Arrange
Path resPath = Paths.get(getClass().getResource("/sample8.yaml").toURI());
Expand All @@ -117,15 +117,17 @@ void testIntEnumSerDeser() throws Exception {

@Test
void testInvalidAlternativeDateDeserialization() {
assertThrows(IllegalArgumentException.class, () -> Serialization.unmarshal(getClass().getResourceAsStream("/sample5.yaml"), CertificateRequest.class));
assertThrows(IllegalArgumentException.class, () -> Serialization.unmarshal(getClass().getResourceAsStream("/sample6.yaml"), CertificateRequest.class));
assertThrows(IllegalArgumentException.class,
() -> Serialization.unmarshal(getClass().getResourceAsStream("/sample5.yaml"), CertificateRequest.class));
assertThrows(IllegalArgumentException.class,
() -> Serialization.unmarshal(getClass().getResourceAsStream("/sample6.yaml"), CertificateRequest.class));
}

@Test
void testEmptyDateDeserialization() {
// Arrange
CertificateRequest sample7 =
Serialization.unmarshal(getClass().getResourceAsStream("/sample7.yaml"), CertificateRequest.class);
CertificateRequest sample7 = Serialization.unmarshal(getClass().getResourceAsStream("/sample7.yaml"),
CertificateRequest.class);

// Act
ZonedDateTime datetime = sample7.getSpec().getDatetime();
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1221,6 +1221,7 @@
<include>src/main/java/**/*.java</include>
<include>src/test/java/**/*.java</include>
<include>src/it/**/src/main/java/**/*.java</include>
<include>src/it/**/src/test/java/**/*.java</include>
</includes>
<eclipse>
<file>ide-config/eclipse-format.xml</file>
Expand Down

0 comments on commit dbd22cd

Please sign in to comment.