cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylv...@apache.org>
Subject Re: Wildcard matcher causes StackOverflowErrors (was Re: StackOverflowError in 2.1)
Date Mon, 10 Jul 2006 08:39:43 GMT
Ralph Goers wrote:
> Carsten Ziegeler wrote:
>> Ralph Goers schrieb:
>>  
>>> Were there test cases for the old wildcard matcher?  Since this
>>> matcher is almost certainly used in every Cocoon deployment we must
>>> guarantee that it is 100% compatible with the old matcher in
>>> BRANCH_2_1_X - unless, of course, there was some specific bug that
>>> needed fixing.  
>> There were only a few test cases for the old matcher; we have much more
>> for the new one. And the old one had specific bugs that we needed to fix
>> and as the old code is very ..ehm..historically grown...it is
>> unmaintainable.
>>
>> Carsten
>>   
> OK. But my question is really that if the old code didn't have unit
> tests how do we know that the new unit tests are compatible with the
> old matcher (i.e - that they get the same results)? 

The best solution to ensure non-regression IMO is to have the same test
case operating on both implementations of the matcher, just differing
for the tests we know to fail in the old implementation (and that
justified the refactoring).

abstract class AbstractWildcardTest extends TestCase {
    AbstractWildcardTest(Matcher matcher)...

    public testSomethingOkInBothImplementations()...

    public testBugInOldImplementation()...
}

public OldWildcardMatcherTestCase extends AbstractWildcardTest {
    public OldWildcardMatcherTestCase() {
        super(new OldWildcardMatcher()); // old code is kept in the test
source tree
    }

    public testBugInOldImplementation {
        try {
            super.testBugInOldImplementation();
        } catch(Exception) {
            return; // expected
        }
        fail("Should fail with old implementation");
}

public WildcardMatcherTestCase extends AbstractWildcardTest {
    public WildcardMatcherTestCase() {
        super(new WildcardMatcher()); // new implementation
    }
}

Sylvain

-- 
Sylvain Wallez - http://bluxte.net


Mime
View raw message