Fix test
Signed-off-by: Emmanuel Bigeon <emmanuel@bigeon.fr>
This commit is contained in:
parent
6993513f38
commit
ddd818d93b
@ -19,8 +19,6 @@ import net.bigeon.gclc.utils.StreamConsoleOutput;
|
|||||||
/** @author Emmanuel Bigeon */
|
/** @author Emmanuel Bigeon */
|
||||||
public class ForwardingRunnableTest {
|
public class ForwardingRunnableTest {
|
||||||
|
|
||||||
/** Test method for {@link net.bigeon.gclc.system.ForwardingRunnable#run()}. */
|
|
||||||
@Test
|
|
||||||
public void testClosedOutput() {
|
public void testClosedOutput() {
|
||||||
final StreamConsoleOutput out = new StreamConsoleOutput();
|
final StreamConsoleOutput out = new StreamConsoleOutput();
|
||||||
out.close();
|
out.close();
|
||||||
@ -43,16 +41,4 @@ public class ForwardingRunnableTest {
|
|||||||
runnable.run();
|
runnable.run();
|
||||||
assertTrue("Error should be an IO", runnable.getError() instanceof IOException);
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user