Skip to content

Commit

Permalink
fix test (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
angelaszek committed Jun 17, 2020
1 parent 3a8777c commit b5016d3
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/test/java/com/imsweb/x12/writer/X12WriterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,20 @@ public void testSerializeComplex() throws IOException {

@Test
public void testPrintFromLoop() throws Exception {
String expected = IOUtils
.toString(this.getClass().getResourceAsStream("/837_5010/x12_writer_test.txt"), StandardCharsets.UTF_8)
.trim();

LineBreak lineBreak;
if (expected.contains(LineBreak.CRLF.getLineBreakString())) {
lineBreak = LineBreak.CRLF;
}
else {
lineBreak = LineBreak.LF;
}

Separators separators = new Separators();
separators.setLineBreak(LineBreak.CRLF);
separators.setLineBreak(lineBreak);
Loop isaLoop = new Loop(separators, "ISA_LOOP");
Segment segment = new Segment("ISA");
addElement(segment, "01", "00");
Expand Down Expand Up @@ -385,11 +397,7 @@ public void testPrintFromLoop() throws Exception {
stLoop.getLoops().add(detail);

X12Writer writer = new X12Writer(FileType.ANSI837_5010_X222, Collections.singletonList(isaLoop), separators);
String writerResult = writer.toX12String(LineBreak.CRLF).trim();

String expected = IOUtils
.toString(this.getClass().getResourceAsStream("/837_5010/x12_writer_test.txt"), StandardCharsets.UTF_8)
.trim();
String writerResult = writer.toX12String(lineBreak).trim();

Assert.assertEquals(expected, writerResult);
}
Expand Down

0 comments on commit b5016d3

Please sign in to comment.