@Test(expected = IllegalArgumentException.class) public void readEntries_shouldRejectAListForWhichAnElementContainsInvalidCharacters() { final List<String> lines = new ArrayList<String>(); for (int i = 0; i < 4; i++) { lines.add(" _ | | _ | | _ | | _ | | _1"); } cut.readEntries(lines); }
@Test(expected = IllegalArgumentException.class) public void readEntries_shouldRejectAListWhichDoesNotContainAMultipleOfFourLines() { final List<String> lines = new ArrayList<String>(); for (int i = 0; i < 3; i++) { lines.add(""); } cut.readEntries(lines); }
@Test public void readEntries_shouldAcceptAListOfStringValues() { final List<String> lines = new ArrayList<String>(); for (int i = 0; i < 4; i++) { lines.add(" _ | | _ | | _ | | _ | | _ "); } cut.readEntries(lines); }
@Test(expected = IllegalArgumentException.class) public void readEntries_shouldRejectAListForWhichEachElementDoesNotContainTwentySevenCharacters() { final List<String> lines = new ArrayList<String>(); for (int i = 0; i < 4; i++) { lines.add("12345678901234567890123456"); } cut.readEntries(lines); }
@Test public void readEntries_shouldSeparateLinesIntoAListOfEntries() { final String testLine = " _ | | _ | | _ | | _ | | _ "; final List<String> testLines = new ArrayList<String>(); for (int i = 0; i < 4; i++) { testLines.add(testLine); } final List<Entry> result = cut.readEntries(testLines); assertThat(result.size(), is(1)); final Entry entry = result.iterator().next(); assertThat(entry.getLines().size(), is(4)); for (final String line : entry.getLines()) { assertThat(line, is(testLine)); } }
@Test(expected = IllegalArgumentException.class) public void readEntries_shouldRejectAnEmptyList() { final List<String> lines = new ArrayList<String>(); cut.readEntries(lines); }
@Test(expected = IllegalArgumentException.class) public void readEntries_shouldRejectANullValuedList() { cut.readEntries(null); }