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