Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Exception when evaluating Json #73

Closed
bradfordhudson opened this Issue · 2 comments

2 participants

@bradfordhudson

I am unable to evaluate a Json response from a GET. No matter what I do, I keep getting an exception. I have the Content-Type and Accept headers both set to application/json as displayed below:

|setHeader |!-
Content-Type:application/json
Accept:application/json
application-key:19c7bbc44108968e01410ec04a230000

Authorization:AccessToken %accessToken%-!|

Whether or not I have a Json snippet in column 5 or a javascript expectation, I always get the exception. As far as I can tell, the Json coming back is properly formed. Below is a snippet of the FitNesse exception:

java.lang.IllegalArgumentException: Cannot evaluate '{"lastPage":true,"pageNumber":0,"totalPages":1,"totalResults":2,"pageContent":["/cloud-connect/CustomerTest","/cloud-connect/sub-org"]}' in {"lastPage":true,"pageNumber":0,"totalPages":1,"totalResults":2,"pageContent":["/cloud-connect/CustomerTest","/cloud-connect/sub-org"]}
at smartrics.rest.fitnesse.fixture.support.XPathBodyTypeAdapter.equals(XPathBodyTypeAdapter.java:77)
at smartrics.rest.fitnesse.fixture.support.JSONBodyTypeAdapter.equals(JSONBodyTypeAdapter.java:74)
at smartrics.rest.fitnesse.fixture.RestFixture.process(RestFixture.java:1022)

I am using the latest FitNesse build from Oct 18, 2013, and I have the RESTFixture which includes this fix:
"SlimFormatter now wraps everything in a DIV in order to deal with FitNesse now escaping everything that doesn't look like HTML by default"
Change-Id: Ifd1a871f6f72711b94a356d796c4654f6b778f84

The latest RESTFixture had problems with the results coming back as HTML, so I need to use this version.

@bradfordhudson

I think that this can probably be closed. The more I was working with this and read more examples, I noticed that you cannot just compare Json to Json, rather use Javascript or some Xpath. When I use something like the following, everything works: jsonbody.pageContent[0]=="foo"
jsonbody.pageContent[1]=="bar"

Is there every any plans to be able to compare Json to Json?

@smartrics
Owner

Hi, so you mean semantic comparison (equivalent to implementing the Object#equal() in java)?
I don't plan to do it in the immediate future

@smartrics smartrics closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.