Package org.springframework.test.web.client

Examples of org.springframework.test.web.client.MockRestServiceServer


  }

  @Test(expected = MissingAuthorizationException.class)
  public void resource_noAccessToken() {
    FacebookTemplate facebook = new FacebookTemplate(); // use anonymous FacebookTemplate in this test
    MockRestServiceServer mockServer = MockRestServiceServer.createServer(facebook.getRestTemplate());
    mockServer.expect(requestTo("https://graph.facebook.com/v2.0/me"))
      .andExpect(method(GET))
      .andRespond(withBadRequest().body(jsonResource("error-400-resource-no-access-token")).contentType(MediaType.APPLICATION_JSON));
    facebook.userOperations().getUserProfile();
  }
View Full Code Here


  }
 
  @Test(expected = MissingAuthorizationException.class)
  public void currentUser_noAccessToken() {
    FacebookTemplate facebook = new FacebookTemplate(); // use anonymous FacebookTemplate in this test
    MockRestServiceServer mockServer = MockRestServiceServer.createServer(facebook.getRestTemplate());
    mockServer.expect(requestTo("https://graph.facebook.com/v2.0/me"))
      .andExpect(method(GET))
      .andRespond(withBadRequest().body(jsonResource("error-400-current-user-no-token")).contentType(MediaType.APPLICATION_JSON));
    facebook.userOperations().getUserProfile();
  }
View Full Code Here

TOP

Related Classes of org.springframework.test.web.client.MockRestServiceServer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.