}
@Test
public void throwsApplicationExceptionIfErrorOccuredDuringDataTransfer() throws Exception {
final int port = somePort();
IntelliJCoderClient client = new IntelliJCoderClient(network, port);
final Socket socket = context.mock(Socket.class);
context.checking(new Expectations(){{
allowing(socket).getOutputStream(); will(throwException(new IOException()));
oneOf(socket).close();
allowing(network).getLocalhostSocket(port); will(returnValue(socket));
}});
try {
client.createProblemWorkspace(someProblem());
fail("should throw an exception");
} catch (Exception e) {
assertExceptionMessage(e, IntelliJCoderClient.SERVER_COMMUNICATION_ERROR_MESSAGE);
}
}