assertThat(response.isSuccessful()).isTrue();
assertThat(response.body()).isEqualTo("Hi");
}</BUG>
@Test public void responseSuccess404() throws IOException {
server.enqueue(new MockResponse().setResponseCode(404).setBody("Hi"));
<BUG>BlockingObservable<Response<String>> o = service.response().toBlocking();
Response<String> response = o.first();
assertThat(response.isSuccessful()).isFalse();
assertThat(response.errorBody().string()).isEqualTo("Hi");
}</BUG>
@Test public void responseFailure() {

assertThat(response.isSuccessful()).isTrue();
assertThat(response.body()).isEqualTo("Hi");
subscriber.assertCompleted();
}
@Test public void responseSuccess404() throws IOException {
server.enqueue(new MockResponse().setResponseCode(404).setBody("Hi"));
TestSubscriber<Response<String>> subscriber = new TestSubscriber<>();
service.response().subscribe(subscriber);
Response<String> response = subscriber.getOnNextEvents().get(0);
assertThat(response.isSuccessful()).isFalse();
assertThat(response.errorBody().string()).isEqualTo("Hi");
subscriber.assertCompleted();
}
