oltu-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simone Tripodi <simonetrip...@apache.org>
Subject Re: JSON comparison in test case best practice
Date Fri, 05 Dec 2014 18:51:53 GMT
just for the record: yes, I noticed it, WWWAuthHeaderParametersApplierTest
does not handle JSON at all :P
please apologise! :D
-Simo

http://people.apache.org/~simonetripodi/
http://twitter.com/simonetripodi

On Fri, Dec 5, 2014 at 11:44 AM, Simone Tripodi <simonetripodi@apache.org>
wrote:

> Looks like there's a nice tool called JSONAssert that does the legwork -
> and I am not surprised someone already thought on doing that :)
> I am fixing broken tests to make them working but will let the discussion
> open in order to find a general agreement... please join!
> All the best,
> -Simo
>
> [1] http://jsonassert.skyscreamer.org/
>
> http://people.apache.org/~simonetripodi/
> http://twitter.com/simonetripodi
>
> On Fri, Dec 5, 2014 at 11:39 AM, Simone Tripodi <simonetripodi@apache.org>
> wrote:
>
>> Hi all mates,
>>
>> there are a couple of tests in the oauth-2.0/common codebase failing on
>> CLI, but succeed in Eclipse, see below for details...
>>
>> I honestly think that comparing serialised JSON strings is not thebest
>> way to assert two JSON documents are representing exactly the same data, we
>> need to handle that situation...
>>
>> Does anybody know a best practice to compare json object, such as XMLDiff
>> of something else?
>> I am asking google, in the meanwhile... :)
>> Best,
>> -Simo
>>
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>
>> OAuthResponseTest.testErrorResponse:47 expected:<{"[error_uri":"
>> http://example-uri","error":"error","param":"value","realm":"album","state":"ok","error_description":"error_description]"}>
>> but
>> was:<{"[param":"value","error_description":"error_description","realm":"album","state":"ok","error":"error","error_uri":"
>> http://example-uri]"}>
>>
>>   WWWAuthHeaderParametersApplierTest.testApplyOAuthParameters:60
>> expected:<...ope="s1 s2 s3",error[_uri="http://www.example.com/error",error="invalid_token]">
>> but was:<...ope="s1 s2 s3",error[="invalid_token",error_uri="
>> http://www.example.com/error]">
>> http://people.apache.org/~simonetripodi/
>> http://twitter.com/simonetripodi
>>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message