From: Harald B. <bra...@gm...> - 2015-02-17 22:13:38
|
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" <bo...@ap...> > An: "Harald Brabenetz" <bra...@gm...> > Cc: xml...@li... > 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 > |