Skip to content

Commit

Permalink
test: ignore line ending in generated specs assertions
Browse files Browse the repository at this point in the history
Is failing in Windows OS

Refs #378
  • Loading branch information
aerfus committed Dec 28, 2023
1 parent be3c479 commit 07a6b30
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.oas.models.media.StringSchema;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -110,7 +111,7 @@ void AsyncAPI_should_map_to_a_valid_asyncapi_json() throws IOException {
String actual = serializer.toJsonString(asyncapi);
InputStream s = this.getClass().getResourceAsStream("/asyncapi/asyncapi.json");
String expected = new String(s.readAllBytes(), StandardCharsets.UTF_8);
assertEquals(expected, actual);
assertEquals(StringUtils.deleteWhitespace(expected), StringUtils.deleteWhitespace(actual));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import jakarta.annotation.Nullable;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -51,7 +52,7 @@ void getDefinitions() throws IOException {
String expected = jsonResource("/schemas/definitions.json");

System.out.println("Got: " + actualDefinitions);
assertEquals(expected, actualDefinitions);
assertEquals(StringUtils.deleteWhitespace(expected), StringUtils.deleteWhitespace(actualDefinitions));
}

@Test
Expand All @@ -62,7 +63,7 @@ void getDocumentedDefinitions() throws IOException {
String expected = jsonResource("/schemas/documented-definitions.json");

System.out.println("Got: " + actualDefinitions);
assertEquals(expected, actualDefinitions);
assertEquals(StringUtils.deleteWhitespace(expected), StringUtils.deleteWhitespace(actualDefinitions));
}

@Test
Expand All @@ -73,7 +74,7 @@ void getArrayDefinitions() throws IOException {
String expected = jsonResource("/schemas/array-definitions.json");

System.out.println("Got: " + actualDefinitions);
assertEquals(expected, actualDefinitions);
assertEquals(StringUtils.deleteWhitespace(expected), StringUtils.deleteWhitespace(actualDefinitions));
}

@Test
Expand All @@ -84,7 +85,7 @@ void getComplexDefinitions() throws IOException {
String expected = jsonResource("/schemas/complex-definitions.json");

System.out.println("Got: " + actualDefinitions);
assertEquals(expected, actualDefinitions);
assertEquals(StringUtils.deleteWhitespace(expected), StringUtils.deleteWhitespace(actualDefinitions));
}

@Test
Expand All @@ -95,7 +96,7 @@ void getListWrapperDefinitions() throws IOException {
String expected = jsonResource("/schemas/generics-wrapper-definitions.json");

System.out.println("Got: " + actualDefinitions);
assertEquals(expected, actualDefinitions);
assertEquals(StringUtils.deleteWhitespace(expected), StringUtils.deleteWhitespace(actualDefinitions));
}

@Test
Expand Down Expand Up @@ -256,7 +257,7 @@ void testSchemaWithOneOf() throws IOException {
String expected = jsonResource("/schemas/annotation-definitions.json");

System.out.println("Got: " + actualDefinitions);
assertEquals(expected, actualDefinitions);
assertEquals(StringUtils.deleteWhitespace(expected), StringUtils.deleteWhitespace(actualDefinitions));
}

@Data
Expand Down

0 comments on commit 07a6b30

Please sign in to comment.