Throwing Hamcrest exception message while actual and expected are same

0 votes

I am getting the below exception message while having actual and expected are same.

@Test    

            public static void Verify()

            {

                given().

                get("http://services.groupkt.com/country/get/all").

                then().body("RestResponse.messages", equalTo("[Total [249] records 

            found.]"));}

FAILED: Verify

java.lang.AssertionError: 1 expectation failed.

JSON path RestResponse.messages doesn't match.

Expected: [Total [249] records found.]

  Actual: [Total [249] records found.]

    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) and much more....
Jun 14, 2018 in Selenium by Martin
• 4,220 points
29 views

1 answer to this question.

0 votes

Below will help you:

Its due to string char I suspect.

    @Test

public void Verify()

{

    given()

            .get("http://services.groupkt.com/country/get/all")

            .then()

            .body("RestResponse.messages[0]",equalTo("Total [249] records found."));}
answered Jun 14, 2018 by Samarpit
• 5,130 points

Related Questions In Selenium

0 votes
1 answer
0 votes
2 answers

How different/ similar are Protractor and Selenium? Which is better?

Protractor and Selenium both are used to ...READ MORE

answered Jun 9 in Selenium by Amod Mahajan
1,348 views
0 votes
1 answer

What are the differences between getText() and getAttribute() functions in Selenium WebDriver?

See, both are used to retrieve something ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,090 points
5,165 views
0 votes
1 answer
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,090 points
570 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
897 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
562 views
0 votes
1 answer

NoSuchElementException exception with headless chrome and selenium

As you are seeing NoSuchElementException you can consider using ...READ MORE

answered May 7, 2018 in Selenium by Samarpit
• 5,130 points
1,925 views
0 votes
1 answer