-1

I'm writing a unit test case, where I'm comparing one json string to expected json string, but the assert equals is having problem.

My code is

output = {"id":12,"firstName":"Vengamamba","lastName":"M"}

assertEquals("{\"id\":\"12\",\"firstName\":\"Vengamamba\",\"lastName\":\"M\"}", output);

It says both are not equal. Any help would be greatly appreciated.

Thanks

1 Answers1

1

They does not looks equals to me neither since you've used \"12\" when it's 12 without quotes in the original.

The assertEquals should works fine

Java: Is assertEquals(String, String) reliable?

Community
  • 1
  • 1
Rafael
  • 2,521
  • 2
  • 33
  • 59