@Test
  public void RestClientException() {
    String exception = "Mocked Exception";

    thrown.expect(RestClientException.class);
    thrown.expectMessage(exception);

    when(restTemplate.getForObject(anyString(), eq(TwitterResponse.class)))
        .thenThrow(new RestClientException(exception));

    twitterSearch.searchByName("MySearch");
  }
  @Test
  public void testSearchByName() throws Exception {
    String searchTerm = "SearchTerm";
    TwitterResponse mockedTwitterResponse = mock(TwitterResponse.class);
    TwitterResult element = mock(TwitterResult.class);
    String searchResults = "SearchResults";

    when(element.getText()).thenReturn(searchResults);
    List<TwitterResult> twitterResponseList = ImmutableList.of(element);
    when(mockedTwitterResponse.getResults()).thenReturn(twitterResponseList);
    when(restTemplate.getForObject(contains(searchTerm), eq(TwitterResponse.class)))
        .thenReturn(mockedTwitterResponse);

    List<TwitterResult> twitterResults = twitterSearch.searchByName(searchTerm);
    assertThat(twitterResults.get(0).getText(), is(searchResults));
  }