@Test public void testGetSticksInputWith2() throws IOException, NumberFormatException, NumberIsOutsideRangeException { when(in.readLine()).thenReturn("2"); assertEquals(2, sut.getStickInput()); }
@Test public void testGetSticksPrintsInstructions() throws IOException, NumberIsOutsideRangeException { try { sut.getStickInput(); } catch (NumberFormatException e) { } verify(out).print("Please write the number of sticks to take, between 1 and 3: "); }
@Test(expected = NumberIsOutsideRangeException.class) public void testGetSticksInputWithInputSmallerThan0() throws IOException, NumberIsOutsideRangeException { when(in.readLine()).thenReturn("-1"); sut.getStickInput(); }
@Test(expected = NumberFormatException.class) public void testGetSticksInputWithInputThatIsNotANumberShouldThrowNumberFormatException() throws IOException, NumberIsOutsideRangeException { when(in.readLine()).thenReturn("x"); sut.getStickInput(); }