Scenario extends BaseOpenMessage { public static Func1<OpenSession, OpenSession> handleResponse(Action0 onSuccess, Action0 onFail) { return handleResponse(onSuccess, onFail, WHO); } private  Scenario(String value); static Scenario requestStart(String where); static Scenario requestStart(String where, Version version); static Scenario requestStop(String where); static Scenario requestStop(String where, Version version); static Func1<OpenSession, OpenSession> handleResponse(Action0 onSuccess, Action0 onFail); static Scenario requestStatus(String where); static Scenario requestStatus(String where, Version version); static Func1<OpenSession, OpenSession> handleStatus(
            Action0 startStatus, Action0 stopStatus, Action0 enableStatus, Action0 disableStatus);  }
@Test public void testHandleResponse() { Action0 onSuccessMock = mock(Action0.class); Action0 onFailMock = mock(Action0.class); OpenSession openSession = OpenSession.newSession(() -> "*17*REQUEST"); openSession.addAllResponse(Lists.newArrayList(() -> OpenMessage.ACK)); Observable.just(openSession) .map(handleResponse(onSuccessMock, onFailMock)) .subscribe(); verify(onSuccessMock).call(); verify(onFailMock, never()).call(); }