Throwing Hamcrest exception message while actual and expected are same

+1 vote

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,330 points
73 views
have you got the solution for this?
Hi!

Below @Samartip's solution did not work for you?

1 answer to this question.

+1 vote

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,890 points

Related Questions In Selenium

0 votes
1 answer

What is the actual conflict while performing click() on web element, and getting an error like element is not clickable at point(x,y)?

Hey @sastry, the error Element is not clickable ...READ MORE

answered Nov 27, 2019 in Selenium by Sirajul
• 55,620 points
1,076 views
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, 2019 in Selenium by Amod Mahajan
2,336 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,510 points
9,558 views
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,510 points
3,158 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,890 points
2,372 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,890 points
2,524 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,890 points
3,972 views
0 votes
3 answers