1
package restAssuredTesting;

import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.equalTo;

import org.testng.annotations.Test;

public class DemoProjectForGet {

    @Test
    public void getWhetherDetails() {
        given()
        .when()
        .get("http:/restapi.demoqa.com/utilities/weather/city/Mumbai")
        .then()
        .statusCode(200)
        .statusLine("HTTP/1.1 200 OK")
        .assertThat().body("City", equalTo("Mumbai"))
        .header("Content-Type", "application/json");
    }

}
John Humphreys
  • 37,047
  • 37
  • 155
  • 255

1 Answers1

1

You're missing a slash in http://.

.get("http:/restapi.demoqa.com/utilities/weather/city/Mumbai")

It should be:

.get("http://restapi.demoqa.com/utilities/weather/city/Mumbai")
John Humphreys
  • 37,047
  • 37
  • 155
  • 255