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,210 points
16 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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
1 answer

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

Okay, so let me talk about the ...READ MORE

answered Apr 2, 2018 in Selenium by nsv999
• 5,030 points
829 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,030 points
3,499 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,030 points
65 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
437 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
51 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,407 views
0 votes
1 answer

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.