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,320 points
817 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,910 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
• 59,230 points
3,555 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
4,044 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,500 points
17,498 views
0 votes
2 answers

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,500 points
13,767 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,186 views
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,910 points
7,261 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,901 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,910 points
8,291 views
0 votes
4 answers
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP