package terminal; import java.io.*; import org.junit.*; 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()); } }