import static org.mockito.Mockito.when;
public class JRubyRackInputTest {
@Test public void shouldWrapJavaIOExceptions() throws Exception {
Ruby ruby = Ruby.newInstance();
RackInput rackInput = mock(RackInput.class);
when(rackInput.read(null)).thenThrow(new IOException("fake"));
JRubyRackInput subject = new JRubyRackInput(ruby, rackInput);
GlobalVariables globalVariables = ruby.getGlobalVariables();
globalVariables.set("$rack_input", subject);