Skip to content
Snippets Groups Projects
Commit fa3a9267 authored by Christopher Bohn's avatar Christopher Bohn :thinking:
Browse files

Updated unit tests to use OS-dependent line separator character(s)

parent 10200b4d
No related branches found
No related tags found
No related merge requests found
...@@ -197,7 +197,7 @@ public class StringBoxTest { ...@@ -197,7 +197,7 @@ public class StringBoxTest {
String input = "foo"; String input = "foo";
int row = 2; int row = 2;
int column = 10; int column = 10;
String expectedOutput = "\n\n foo"; String expectedOutput = String.format("%n%n foo");
// Act // Act
String actualOutput = stringBox.placeString(input, row, column).toString(false); String actualOutput = stringBox.placeString(input, row, column).toString(false);
// Assert // Assert
...@@ -207,34 +207,39 @@ public class StringBoxTest { ...@@ -207,34 +207,39 @@ public class StringBoxTest {
@Test @Test
public void testNormalCases() { public void testNormalCases() {
// Arrange // Arrange
@SuppressWarnings("SpellCheckingInspection") String[] inputs = {"foo\nbar", "larry\ncurly\nmoe", "quux\nxyzzy" @SuppressWarnings("SpellCheckingInspection") String[] inputs = {
, "one\ntwo\nthree"}; String.format("foo%nbar"),
String.format("larry%ncurly%nmoe"),
String.format("quux%nxyzzy"),
String.format("one%ntwo%nthree")
};
int[] rows = {2, 5, 3, 10}; int[] rows = {2, 5, 3, 10};
int[] columns = {10, 5, 20, 15}; int[] columns = {10, 5, 20, 15};
@SuppressWarnings("SpellCheckingInspection") String expectedOutput = //noinspection SpellCheckingInspection
"\n" + // 0 String expectedOutput = String.format(
"\n" + // 1 "%n" + // 0
" foo\n" + // 2 "%n" + // 1
" larrybar quux\n" + // 3 " foo%n" + // 2
" curly xyzzy\n" + // 4 " larrybar quux%n" + // 3
" moe\n" + // 5 " curly xyzzy%n" + // 4
"\n" + // 6 " moe%n" + // 5
"\n" + // 7 "%n" + // 6
" one\n" + // 8 "%n" + // 7
" two\n" + // 9 " one%n" + // 8
" three\n" + // 10 " two%n" + // 9
"\n" + // 11 " three%n" + // 10
"\n" + // 12 "%n" + // 11
"\n" + // 13 "%n" + // 12
"\n" + // 14 "%n" + // 13
"\n" + // 15 "%n" + // 14
"\n" + // 16 "%n" + // 15
"\n" + // 17 "%n" + // 16
"\n" + // 18 "%n" + // 17
"\n" + // 19 "%n" + // 18
"\n" + // 20 "%n" + // 19
"\n" + // 21 "%n" + // 20
""; // 22 "%n" + // 21
""); // 22
// Act // Act
String actualOutput = stringBox String actualOutput = stringBox
.placeStringAlignTopLeft(inputs[0], rows[0], columns[0]) .placeStringAlignTopLeft(inputs[0], rows[0], columns[0])
...@@ -249,7 +254,7 @@ public class StringBoxTest { ...@@ -249,7 +254,7 @@ public class StringBoxTest {
@Test @Test
public void testEmptyBox() { public void testEmptyBox() {
// Arrange // Arrange
String expectedOutput = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"; String expectedOutput = String.format("%n%n%n%n%n%n%n%n%n%n%n%n%n%n%n%n%n%n%n%n%n%n%n");
// Act // Act
String actualOutput = stringBox.toString(true); String actualOutput = stringBox.toString(true);
// Assert // Assert
...@@ -259,7 +264,8 @@ public class StringBoxTest { ...@@ -259,7 +264,8 @@ public class StringBoxTest {
@Test @Test
public void testNegativeTopRow() { public void testNegativeTopRow() {
// Arrange // Arrange
String input = "foo\nbar"; //noinspection SpellCheckingInspection
String input = String.format("foo%nbar");
int row = -1; int row = -1;
int column = 10; int column = 10;
String expectedOutput = " bar"; String expectedOutput = " bar";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment