@SuppressWarnings("unchecked") @Test public void testOSPromptPatternIsHonored() throws Exception { final JSchSshTerminal timeoutTerminal = new JSchSshTerminal(); final ExpectState expectState = mock(ExpectState.class); when(expectState.getMatch(0)).thenReturn("match string"); final Expect4j expect = mock(Expect4j.class); when(expect.expect(any(List.class))).thenReturn(1); when(expect.getLastState()).thenReturn(expectState); whenNew(Expect4j.class).withAnyArguments().thenReturn(expect); executeCommandsHelper(timeoutTerminal, Collections.singletonList("blarg!"), "os-prompt-pattern>>"); final ArgumentCaptor<OutputStream> fileCaptor = ArgumentCaptor.forClass(OutputStream.class); verify(expect).send("blarg!"); verify(expect).send("\r"); verify(expect).expect(argumentCaptorListMatch.capture()); assertThat(argumentCaptorListMatch.getAllValues().size()).isEqualTo(1); assertThat(((RegExpMatch) argumentCaptorListMatch.getAllValues().get(0).get(0)).getPattern().getPattern()) .isEqualTo("os-prompt-pattern>>"); verify(shell).setOutputStream(fileCaptor.capture()); fileCaptor.getValue().close(); }
public void setOutputStream(final OutputStream stream) { this.stream = stream; }
JSchSshTerminal { public void setOutputStream(final OutputStream stream) { this.stream = stream; } }
JSchSshTerminal { public void setOutputStream(final OutputStream stream) { this.stream = stream; } JSchSshTerminal();  JSchSshTerminal(final ConnectionPool pool); }
JSchSshTerminal { public void setOutputStream(final OutputStream stream) { this.stream = stream; } JSchSshTerminal();  JSchSshTerminal(final ConnectionPool pool); TerminalResponse executeCommandGroups(final List<CommandExpectationGroup> commandExpectationGroups); void setOutputStream(final OutputStream stream); void setExpectationTimeout(final long expectationTimeout); }
JSchSshTerminal { public void setOutputStream(final OutputStream stream) { this.stream = stream; } JSchSshTerminal();  JSchSshTerminal(final ConnectionPool pool); TerminalResponse executeCommandGroups(final List<CommandExpectationGroup> commandExpectationGroups); void setOutputStream(final OutputStream stream); void setExpectationTimeout(final long expectationTimeout);  }