Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

normalize expected values read from files #320

Merged
merged 1 commit into from
Dec 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
import io.xlate.edi.stream.EDIStreamWriter;
import io.xlate.edi.stream.EDIValidationException;
import io.xlate.edi.stream.Location;
import io.xlate.edi.test.StaEDITestUtil;

@SuppressWarnings("resource")
class StaEDIStreamWriterTest {
Expand Down Expand Up @@ -714,6 +715,7 @@ public int read() throws IOException {
ByteArrayOutputStream result = new ByteArrayOutputStream(16384);
writeFromReader(reader, blocked, result);
final String expected = Stream.of(readBuffer.toString("UTF-8"))
.map(StaEDITestUtil::normalizeLines)
.map(exp -> blocked ? exp.replace("\n", "") : exp)
.map(String::trim)
.findFirst()
Expand Down Expand Up @@ -920,7 +922,7 @@ public int read() throws IOException {
reader.close();
}

assertEquals(expected.toString().trim(), normalizeLines(result.toString().trim()));
assertEquals(normalizeLines(expected.toString().trim()), normalizeLines(result.toString().trim()));
}

@Test
Expand Down Expand Up @@ -1032,7 +1034,7 @@ public int read() throws IOException {
reader.close();
}

assertEquals(expected.toString().trim(), normalizeLines(result.toString().trim()));
assertEquals(normalizeLines(expected.toString().trim()), normalizeLines(result.toString().trim()));
}

@Test
Expand Down Expand Up @@ -1135,7 +1137,7 @@ public int read() throws IOException {
}

System.out.println(expected.toString());
assertEquals(expected.toString().trim(), normalizeLines(result.toString().trim()));
assertEquals(normalizeLines(expected.toString().trim()), normalizeLines(result.toString().trim()));
}

@Test
Expand Down