2017-03-24 09:29:19 -04:00
|
|
|
package terminal;
|
|
|
|
|
2017-11-12 09:42:25 -05:00
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.PipedInputStream;
|
|
|
|
import java.io.PipedOutputStream;
|
2017-03-24 09:29:19 -04:00
|
|
|
|
2017-11-12 09:42:25 -05:00
|
|
|
import org.junit.Before;
|
|
|
|
import org.junit.Test;
|
2017-03-24 09:29:19 -04:00
|
|
|
|
|
|
|
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());
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|