Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. package com.wellsmith;
  2.  
  3. import io.restassured.response.Response;
  4. import org.testng.Assert;
  5. import org.testng.annotations.Test;
  6.  
  7. import java.io.File;
  8.  
  9.  
  10. public class WellSmithApiCallTest {
  11.  
  12. WellSmithApiCall obj = new WellSmithApiCall();
  13.  
  14.  
  15. @Test
  16. public void testMethodGetAccounts() {
  17. Response response = obj.getAccounts();
  18. Assert.assertEquals(200, response.statusCode());
  19. }
  20.  
  21. @Test
  22. public void testCreatePlaybookApi() {
  23.  
  24. String path = "/api/patients";
  25.  
  26. File file = new File("/Users/sumesh.adhikari/IdeaProjects/TwitterTest/src/test/resources/playbook.json");
  27.  
  28. Response response = obj.getPostResponse(path, file);
  29. Assert.assertEquals(201, response.getStatusCode());
  30.  
  31.  
  32. String location = response.getHeader("Location");
  33.  
  34. String patientId = location.replace(path + "/", "");
  35.  
  36. System.out.println(patientId);
  37.  
  38. Response getResponse = obj.getGetResponse(location);
  39.  
  40. Assert.assertEquals(200, getResponse.getStatusCode());
  41.  
  42.  
  43. }
  44.  
  45. @Test
  46. public void testGetPlaybook(){
  47. String path = "/api/playbooks/3000098";
  48. Response response = obj.getGetPlaybook(path);
  49. Assert.assertEquals(200, response.getStatusCode());
  50. }
  51.  
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement