Signed-off-by: Emmanuel Bigeon <emmanuel@bigeon.fr>
This commit is contained in:
Emmanuel Bigeon 2018-11-25 00:40:54 -05:00
parent 6993513f38
commit ddd818d93b

View File

@ -19,8 +19,6 @@ import net.bigeon.gclc.utils.StreamConsoleOutput;
/** @author Emmanuel Bigeon */
public class ForwardingRunnableTest {
/** Test method for {@link net.bigeon.gclc.system.ForwardingRunnable#run()}. */
@Test
public void testClosedOutput() {
final StreamConsoleOutput out = new StreamConsoleOutput();
out.close();
@ -43,16 +41,4 @@ public class ForwardingRunnableTest {
runnable.run();
assertTrue("Error should be an IO", runnable.getError() instanceof IOException);
}
@Test
public void testIOInClose() throws IOException {
final InputStream is = Mockito.mock(InputStream.class);
Mockito.when(is.read()).thenReturn(-1);
Mockito.doThrow(new IOException()).when(is).close();
final ForwardingRunnable runnable = new ForwardingRunnable(SinkOutput.INSTANCE,
is);
// Runnable should close immediatly.
runnable.run();
assertTrue("Error should be an IO", runnable.getError() instanceof IOException);
}
}