transcendental-lisp/test/terminal/TerminalConfigurationTest.java

39 lines
1017 B
Java
Raw Normal View History

2017-03-24 09:29:19 -04:00
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());
}
}