Advertisement
Guest User

Untitled

a guest
Jul 26th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. package com.automation.com.automation.<name>;
  2.  
  3. import org.json.simple.JSONObject;
  4. import org.json.simple.parser.JSONParser;
  5. import org.junit.Test;
  6.  
  7. import static com.jayway.restassured.RestAssured.*;
  8.  
  9. import java.io.FileNotFoundException;
  10. import java.io.FileReader;
  11.  
  12. public class SendDCandidateDate {
  13.  
  14. @Test
  15. public void sendCandidateData() throws FileNotFoundException {
  16.  
  17.  
  18. String accessToken = "<your access token comes here>";
  19. String apiUrl = "<your API url comes here>";
  20.  
  21. JSONParser parser = new JSONParser();
  22. try {
  23. Object object = parser.parse(new FileReader("src/main/resources/Full_List.json"));
  24. JSONObject jsonObject = (JSONObject) object;
  25. given().auth().preemptive().oauth2(accessToken);
  26. given().body(jsonObject).when().post(apiUrl).then().assertThat().statusCode(200);
  27.  
  28. }catch (Exception ex) {
  29. System.out.println(ex);
  30. }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement