[java] test task

Viewer

copydownloadembedprintName: test task
  1. @Test
  2.    public void aCarEntersAndThenLeaves() {
  3.        Car car = new Car();
  4.      car.setPlateNumber("xyx1111");
  5.      car.setBrand("audi");
  6.      car.setColour("red");
  7.  
  8.      int positionTakenInGarage = given()
  9.      .contentType("application/json")
  10.      .body(car)
  11.      .when().post("/garage/slots").then()
  12.      .body("empty",equalTo(false))
  13.      .extract().path("position");
  14.  
  15.      given().pathParam("slotID", positionTakenInGarage)
  16.      .when().delete("/garage/slots/{slotID}").then()
  17.      .statusCode(200);
  18.  
  19.    }
  20.  
  21.  
  22. @Test
  23. public void test_ResponseHeaderData_ShouldBeCorrect() {
  24.         
  25.     given().
  26.     when().
  27.         get("http://ergast.com/api/f1/2017/circuits.json").
  28.     then().
  29.         assertThat().
  30.         statusCode(200).
  31.     and().
  32.         contentType(ContentType.JSON).
  33.     and().
  34.         header("Content-Length",equalTo("4567"));
  35. }
  36.  
  37.  

Editor

You can edit this paste and save as new:


File Description
  • test task
  • Paste Code
  • 01 Mar-2021
  • 868 Bytes
You can Share it: