package terminal; import java.io.IOException; import java.io.PipedInputStream; import java.io.PipedOutputStream; import org.junit.Before; import org.junit.Test; import stream.UncheckedIOException; public class TerminalConfigurationTest { TerminalConfiguration configuration; private PipedOutputStream createIOExceptionThrowingPipedOutputStream() { return new PipedOutputStream() { @Override public void connect(PipedInputStream inputStream) throws IOException { throw new IOException(); } }; } @Before public void setUp() { configuration = new TerminalConfiguration(); } @Test(expected = UncheckedIOException.class) public void setInputPairThrowsUncheckedException() { configuration.setInputPair(createIOExceptionThrowingPipedOutputStream(), new PipedInputStream()); } @Test(expected = UncheckedIOException.class) public void setOutputPairThrowsUncheckedException() { configuration.setOutputPair(createIOExceptionThrowingPipedOutputStream(), new PipedInputStream()); } }