- Updated test names to reflect what it is testing
This commit is contained in:
@@ -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();
|
||||||
|
|||||||
Reference in New Issue
Block a user