Return-Path: X-Original-To: apmail-oltu-dev-archive@www.apache.org Delivered-To: apmail-oltu-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CD6131044A for ; Sat, 6 Dec 2014 21:02:23 +0000 (UTC) Received: (qmail 53255 invoked by uid 500); 6 Dec 2014 21:02:23 -0000 Delivered-To: apmail-oltu-dev-archive@oltu.apache.org Received: (qmail 53211 invoked by uid 500); 6 Dec 2014 21:02:23 -0000 Mailing-List: contact dev-help@oltu.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@oltu.apache.org Delivered-To: mailing list dev@oltu.apache.org Received: (qmail 53200 invoked by uid 99); 6 Dec 2014 21:02:22 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Dec 2014 21:02:22 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of asanso@adobe.com designates 65.55.169.86 as permitted sender) Received: from [65.55.169.86] (HELO na01-bl2-obe.outbound.protection.outlook.com) (65.55.169.86) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Dec 2014 21:01:56 +0000 Received: from CO1PR02MB206.namprd02.prod.outlook.com (10.242.165.144) by CO1PR02MB205.namprd02.prod.outlook.com (10.242.165.139) with Microsoft SMTP Server (TLS) id 15.1.31.17; Sat, 6 Dec 2014 21:01:52 +0000 Received: from CO1PR02MB206.namprd02.prod.outlook.com ([169.254.8.137]) by CO1PR02MB206.namprd02.prod.outlook.com ([169.254.8.137]) with mapi id 15.01.0031.000; Sat, 6 Dec 2014 21:01:52 +0000 From: Antonio Sanso To: "dev@oltu.apache.org" Subject: Re: JSON comparison in test case best practice Thread-Topic: JSON comparison in test case best practice Thread-Index: AQHQELshCsNoEAtsX0WX/mr4TDC3hpyBVW2AgAACLoCAAAFjgIAAL8KAgAGGtwA= Date: Sat, 6 Dec 2014 21:01:50 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [178.83.47.250] x-microsoft-antispam: BCL:0;PCL:0;RULEID:;SRVR:CO1PR02MB205; x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:;SRVR:CO1PR02MB205; x-forefront-prvs: 0417A3FFD2 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6009001)(377454003)(24454002)(189002)(199003)(51704005)(53754006)(450100001)(62966003)(110136001)(50986999)(106356001)(106116001)(101416001)(33656002)(19625305001)(68736005)(54356999)(76176999)(15975445007)(31966008)(82746002)(36756003)(107046002)(107886001)(2351001)(102836002)(77156002)(105586002)(99286002)(122556002)(40100003)(46102003)(92566001)(87936001)(15395725005)(20776003)(66066001)(4396001)(93886004)(1720100001)(97736003)(86362001)(21056001)(64706001)(19580405001)(2501002)(2656002)(83716003)(99396003)(19580395003)(120916001)(104396002)(17404325003);DIR:OUT;SFP:1101;SCL:1;SRVR:CO1PR02MB205;H:CO1PR02MB206.namprd02.prod.outlook.com;FPR:;SPF:None;MLV:sfv;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: adobe.com X-Virus-Checked: Checked by ClamAV on apache.org hi Simo, see comment in the issue regards antonio On Dec 5, 2014, at 10:47 PM, Simone Tripodi wrot= e: > patch attached! :P >=20 > http://people.apache.org/~simonetripodi/ > http://twitter.com/simonetripodi >=20 > On Fri, Dec 5, 2014 at 11:56 AM, Simone Tripodi > wrote: >=20 >> last message, promised: I followed up on OLTU-164 >>=20 >> best, >> -Simo >>=20 >> http://people.apache.org/~simonetripodi/ >> http://twitter.com/simonetripodi >>=20 >> On Fri, Dec 5, 2014 at 11:51 AM, Simone Tripodi >> wrote: >>=20 >>> just for the record: yes, I noticed it, WWWAuthHeaderParametersApplierT= est >>> does not handle JSON at all :P >>> please apologise! :D >>> -Simo >>>=20 >>> http://people.apache.org/~simonetripodi/ >>> http://twitter.com/simonetripodi >>>=20 >>> On Fri, Dec 5, 2014 at 11:44 AM, Simone Tripodi >>> wrote: >>>=20 >>>> 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 >>>>=20 >>>> [1] http://jsonassert.skyscreamer.org/ >>>>=20 >>>> http://people.apache.org/~simonetripodi/ >>>> http://twitter.com/simonetripodi >>>>=20 >>>> On Fri, Dec 5, 2014 at 11:39 AM, Simone Tripodi < >>>> simonetripodi@apache.org> wrote: >>>>=20 >>>>> Hi all mates, >>>>>=20 >>>>> there are a couple of tests in the oauth-2.0/common codebase failing = on >>>>> CLI, but succeed in Eclipse, see below for details... >>>>>=20 >>>>> I honestly think that comparing serialised JSON strings is not thebes= t >>>>> way to assert two JSON documents are representing exactly the same da= ta, we >>>>> need to handle that situation... >>>>>=20 >>>>> 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 >>>>>=20 >>>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~ >>>>>=20 >>>>> 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]"}> >>>>>=20 >>>>> WWWAuthHeaderParametersApplierTest.testApplyOAuthParameters:60 >>>>> expected:<...ope=3D"s1 s2 s3",error[_uri=3D"http://www.example.com/er= ror",error=3D"invalid_token]"> >>>>> but was:<...ope=3D"s1 s2 s3",error[=3D"invalid_token",error_uri=3D" >>>>> http://www.example.com/error]"> >>>>> http://people.apache.org/~simonetripodi/ >>>>> http://twitter.com/simonetripodi >>>>>=20 >>>>=20 >>>>=20 >>>=20 >>=20