Hi,
I found a third and better way:
I will wrap instead extend the CompareMatcher.
So the constructor of CompareMatcher can be leaved private and non-extendable:
https://github.com/brabenetz/xmlunit/commit/642cd29b34494da1f444ea47ce546957b07cb4e2

At least for XmlUnit it's much cleaner.

with friendly regards,
Harald


> Gesendet: Montag, 16. Februar 2015 um 12:52 Uhr
> Von: "Stefan Bodewig" <[email protected]>
> An: "Harald Brabenetz" <[email protected]>
> Cc: [email protected]
> Betreff: CompareMatcher (was Re: ComparisonControllers.StopWhenSimilar)
>
> On 2015-02-16, Harald Brabenetz wrote:
> 
> > I would like to make the CompareMatcher extendable.  This means that
> > the constructor and two methods must be protected instead private.
> 
> The two protected methods would be the checkFor methods?  You need those
> so you can have your own factory methods, AFAIU.  If this was the only
> usecase they could be final.
> 
> > This example is basically what I do with the Matcher on my current
> > Project: I write the test-Input into the FileSystem, where I can
> > manual review it.  And when the changes are OK I can simply overwrite
> > my control-File with the written Test-File.
> 
> You are cheating ;-)
> 
> > On the other hand it is more difficult to maintain a Class which can
> > be extended.
> 
> A protected constructor will signal "this class is extension friendly"
> so we better review its API and implementation to see whether this
> really is the case.  Other than that, I don't see any issue.
> 
> Stefan
> 

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
Xmlunit-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xmlunit-general

Reply via email to