Skip to main content
Bumped by Community user
added 14 characters in body
Source Link
dzieciou
  • 10.5k
  • 9
  • 48
  • 102

When we assert our body part, we use the method equalTo() but while asserting for Header, we are just providing ("Key","value") pair only. Why can't we use just- body("scope","APP") Any specific reason behind this?

Below is the actual code.

assertThat().statusCode(200).body("scope",equalTo("APP")).header("Server","Apache/2.4.18 (Ubuntu)");

assertThat()
  .statusCode(200)
  .body("scope",equalTo("APP"))
  .header("Server","Apache/2.4.18 (Ubuntu)");

When we assert our body part, we use the method equalTo() but while asserting for Header, we are just providing ("Key","value") pair only. Why can't we use just- body("scope","APP") Any specific reason behind this?

Below is the actual code.

assertThat().statusCode(200).body("scope",equalTo("APP")).header("Server","Apache/2.4.18 (Ubuntu)");

When we assert our body part, we use the method equalTo() but while asserting for Header, we are just providing ("Key","value") pair only. Why can't we use just- body("scope","APP") Any specific reason behind this?

Below is the actual code.

assertThat()
  .statusCode(200)
  .body("scope",equalTo("APP"))
  .header("Server","Apache/2.4.18 (Ubuntu)");
Bumped by Community user
Bumped by Community user
Bumped by Community user
Source Link

REST Assured API | Why we use equalTo() while asserting body part of response?

When we assert our body part, we use the method equalTo() but while asserting for Header, we are just providing ("Key","value") pair only. Why can't we use just- body("scope","APP") Any specific reason behind this?

Below is the actual code.

assertThat().statusCode(200).body("scope",equalTo("APP")).header("Server","Apache/2.4.18 (Ubuntu)");