From d5ac10ac87433d27a49d02e7994347b65fa2090a Mon Sep 17 00:00:00 2001 From: Mungo Carstairs Date: Tue, 22 Oct 2019 16:44:03 +0100 Subject: [PATCH] JAL-3423 more System.lineSeparator() in place of \n --- test/jalview/analysis/TestAlignSeq.java | 18 +++++++++--------- test/jalview/math/RotatableMatrixTest.java | 7 +++++-- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/test/jalview/analysis/TestAlignSeq.java b/test/jalview/analysis/TestAlignSeq.java index 955cca7..d20c52b 100644 --- a/test/jalview/analysis/TestAlignSeq.java +++ b/test/jalview/analysis/TestAlignSeq.java @@ -42,6 +42,7 @@ import org.testng.annotations.Test; */ public class TestAlignSeq { + private static final String NL = System.lineSeparator(); @BeforeClass(alwaysRun = true) public void setUpJvOptionPane() @@ -120,24 +121,23 @@ public class TestAlignSeq @Override public void print(String x) { - baos.append(x.replaceAll("\r", "")); + baos.append(x); } @Override public void println() { - baos.append("\n"); + baos.append(NL); } }; as.printAlignment(ps); - String expected = "Score = 320.0\n" + "Length of alignment = 10\n" - + "Sequence Seq1/4-13 (Sequence length = 14)\n" - + "Sequence Seq3/1-10 (Sequence length = 10)\n" + "\n" - + "Seq1/4-13 SDFAQQQRRR\n" - + " ||||||| \n" - + "Seq3/1-10 SDFAQQQSSS\n" + "\n" + "Percentage ID = 70.00\n" - + "\n"; + String expected = "Score = 320.0" + NL + "Length of alignment = 10" + NL + + "Sequence Seq1/4-13 (Sequence length = 14)" + NL + + "Sequence Seq3/1-10 (Sequence length = 10)" + NL + NL + + "Seq1/4-13 SDFAQQQRRR" + NL + " ||||||| " + NL + + "Seq3/1-10 SDFAQQQSSS" + NL + NL + "Percentage ID = 70.00" + + NL + NL; String s = baos.toString(); System.out.println(s); diff --git a/test/jalview/math/RotatableMatrixTest.java b/test/jalview/math/RotatableMatrixTest.java index e04df85..fb0532d 100644 --- a/test/jalview/math/RotatableMatrixTest.java +++ b/test/jalview/math/RotatableMatrixTest.java @@ -12,6 +12,8 @@ import org.testng.annotations.Test; public class RotatableMatrixTest { + private static final String NL = System.lineSeparator(); + private RotatableMatrix rm; @BeforeMethod(alwaysRun = true) @@ -36,12 +38,13 @@ public class RotatableMatrixTest @Test(groups = "Functional") public void testPrint() { - String expected = "0.5 1.0 1.5\n1.0 2.0 3.0\n1.5 3.0 4.5\n"; + String expected = "0.5 1.0 1.5" + NL + "1.0 2.0 3.0" + NL + + "1.5 3.0 4.5" + NL; ByteArrayOutputStream os = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(os, true); rm.print(ps); String result = new String(os.toByteArray()); - assertEquals(result.replaceAll("\r", ""), expected); + assertEquals(result, expected); } @Test(groups = "Functional") -- 1.7.10.2