- Updated test names to reflect what it is testing

This commit is contained in:
vatsalgosar
2019-10-30 00:07:04 +05:30
parent d102bbe6cb
commit e8a597b5e9

View File

@@ -29,14 +29,15 @@ public class JavaScannerUnitTest {
} }
@Test(expected = NoSuchElementException.class) @Test(expected = NoSuchElementException.class)
public void whenReadingLines_thenThrowNoSuchElementException() {
public void givenNoNewLine_whenReadingNextLine_thenThrowNoSuchElementException() {
try (Scanner scanner = new Scanner("")) { try (Scanner scanner = new Scanner("")) {
String result = scanner.nextLine(); String result = scanner.nextLine();
} }
} }
@Test(expected = IllegalStateException.class) @Test(expected = IllegalStateException.class)
public void whenReadingLines_thenThrowIllegalStateException() { public void givenScannerIsClosed_whenReadingNextLine_thenThrowIllegalStateException() {
Scanner scanner = new Scanner(""); Scanner scanner = new Scanner("");
scanner.close(); scanner.close();
String result = scanner.nextLine(); String result = scanner.nextLine();