0

I'm developing an API Automation test using rest assured. My API response is like:

{
    "is_active": true,
    "token": "s4vj75pj6********"
}

When I send an invalid count is like:

{
    "is_active": false,
    "token": ""
}

So I want to validate the reponse is "true", I developed the following code:

public void responseLoginFacebookBody () {
            Assert.assertTrue(ResponseHolder.getResponseBody().contains("is_active"));
            String responseStatus = ResponseHolder.getResponseJson().get("is_active");
            Assert.assertTrue(responseStatus.equalsIgnoreCase("true"));
        }

but I'm receiving the following message:

java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.String

How can I validate it?

Samuel Philipp
  • 10,631
  • 12
  • 36
  • 56
Cleicy Guião
  • 111
  • 1
  • 20

1 Answers1

3

change responseStatus to boolean. It isn't a string in your API response

joshua0823
  • 370
  • 1
  • 10