From: Harald B. <bra...@gm...> - 2015-01-18 10:14:18
|
Hi, for better Explanations, here are my checkins: All changes for implementing DiffBuilder and ComparisonFormatter so far: https://github.com/brabenetz/xmlunit/commit/f4408ea23eca8afaff28b5b11dfea6bc67735f4e "DifferenceEvaluators.sequence(...)" (I has updated the DifferenceEvaluatorsTest in the next commit): https://github.com/brabenetz/xmlunit/commit/cd88ac571d72582451a59f21b7a8cdffbff8b903 DiffBuilder.withDifferenceEvaluators(...) and withDifferenceEvaluators.deactivateDefaultDifferenceEvaluator(): https://github.com/brabenetz/xmlunit/commit/f05706c13a4d4a19602857b052971bb865f5ae06 Let me know what you think, I will merge all you want together for a single push request. with friendly regards, Harald > Gesendet: Samstag, 17. Januar 2015 um 00:27 Uhr > Von: "Harald Brabenetz" <bra...@gm...> > An: "Stefan Bodewig" <bo...@ap...>, xml...@li... > Betreff: Re: [Xmlunit-general] xmlunit.org > > > Hi, > > I have a few questions about the DifferenceEvaluators: > > >> But I think that one DifferenceEvaluator is not enough. > >> At least DifferenceEvaluators.Default should always be part of, > >> otherwise there is no ComparisonResult.SIMILAR. > > > >IMHO this is something the user of the API should take care of. If they > >want to have DEFAULT's behaviour then they should include it explicitly. > > > You think, that the code should look like the following?: > ---------- > Diff myDiff = DiffBuilder.compare(control).withTest(test) > .withDifferenceEvaluator(DifferenceEvaluators.first( > DifferenceEvaluators.Default, > new IgnoreAttributeDifferenceEvaluator("attr"))) > .checkForSimilar() > .build(); > ---------- > I think "checkForSimilar" will be the preferred method to compare two XMLs. > But checkForSimilar() makes no sense without "DifferenceEvaluators.Default". > On the other site I can't think of a situation where the "DifferenceEvaluators.Default" must be ignored to get a special goal? > Even this rare cases could simply be handled with a method ".deactivateDefaultDifferenceEvaluator()" > > I checked in the UnitTest: > https://github.com/brabenetz/xmlunit/commit/4a8e5eb676809344a6dbaf814289a6495db80728 > > >> But then I need a method like DifferenceEvaluators.inSequence(...) > >> instead of DifferenceEvaluators.first(...). > > > >first() picks the first that changes the outcome, what would be the > >result of inSequence()? > > > Simply passes the result to the next evaluator. > Reason: The custom DifferenceEvaluator should also be triggered (e.g.: for Ignore) even if a Node was marked as "similar" before. > And maybe the custom DifferenceEvaluator want to check if the Difference was "similar". > > > >> I also think about a general SimpleIgnoreNodesDifferenceEvaluator > >> (ignore some nodes) or a SimpleBigDecimalNodesDifferenceEvaluator > >> (which evaluates "1" similar "1.00") implementations. > > > >The first one hints at the missing feature of ignoring parts completely. > >I don't think DifferenceEvaluator is the best place for this. The > >second one sounds like a third jar of xmlunit-library rather than -core? > > > Yes, it could be a third jar of xmlunit-library. > What you mean with "DifferenceEvaluator is not the best place for this"? Is there another way? > > > Thanks, > Harald > > ------------------------------------------------------------------------------ > New Year. New Location. New Benefits. New Data Center in Ashburn, VA. > GigeNET is offering a free month of service with a new server in Ashburn. > Choose from 2 high performing configs, both with 100TB of bandwidth. > Higher redundancy.Lower latency.Increased capacity.Completely compliant. > http://p.sf.net/sfu/gigenet > _______________________________________________ > Xmlunit-general mailing list > Xml...@li... > https://lists.sourceforge.net/lists/listinfo/xmlunit-general > |