Spring Framework RestClientException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework RestClientException class.

This code example shows how to use the following methods:
        assertThat(((GettingStartedGuide) model.get("guide")), is(guide));
    } 
 
    @Test(expected = RestClientException.class)
    public void viewGuide_fails() { 
        given(guides.find("rest-service")).willThrow(new RestClientException("Is GitHub down?"));
        controller.viewGuide("rest-service", model);
    } 
 
    @Test
    public void loadImage() { 
        byte[] image = "animage".getBytes();
        given(guides.find(anyString())).willReturn(guide);
        given(guides.loadImage(guide, "welcome.png")).willReturn(image);
        ResponseEntity<byte[]> responseEntity = controller.loadImage("rest-service", "welcome.png");
        assertThat(responseEntity.getBody(), is(image));
    } 
 
} 
4
CodeRank
This code example shows how to use the following methods:
 
    @Test
    public void testShouldFailWhenApiIsUnableToRetrieveUserProfile() { 
        UserOperations userOperations = mock(UserOperations.class);
        when(yammer.userOperations()).thenReturn(userOperations);
        when(userOperations.getUserProfile()).thenThrow(new RestClientException("unable to retrieve user profile"));
 
        boolean isApiOK = apiAdapter.test(yammer);
 
        assertFalse(isApiOK);
    } 
} 
4
CodeRank
This code example shows how to use the following methods:getMessage
   * wrapping an arbitrary HibernateException. 
   * 
   * @param cause the HibernateException thrown 
   */ 
  public UncategorizedCouchDataAccessException(RestClientException cause) {
    super(cause != null ? cause.getMessage() : null, cause);
  } 
 
} 
 
4
CodeRank