Sha256: 059fd09a6982e288f157e4856745472e773e77ae2732e67041932950c7e84d9a

Contents?: true

Size: 1.06 KB

Versions: 4

Compression:

Stored size: 1.06 KB

Contents

package org.mortbay.jetty.handler.rewrite;

public class LegacyRuleTest extends AbstractRuleTestCase
{
    private LegacyRule _rule;
    
    String[][] _tests=
    {
            {"/foo/bar","/*","/replace/foo/bar"},
            {"/foo/bar","/foo/*","/replace/bar"},
            {"/foo/bar","/foo/bar","/replace"}
    };
    
    public void setUp() throws Exception
    {
        super.setUp();
        _rule = new LegacyRule();
    }
    
    public void tearDown()
    {
        _rule = null;
    }
    
    public void testMatchAndApply() throws Exception
    {
        for (int i=0;i<_tests.length;i++)
        {
            _rule.addRewriteRule(_tests[i][1], "/replace");
            
            String result = _rule.matchAndApply(_tests[i][0], _request, _response);
        
            assertEquals(_tests[i][1], _tests[i][2], result);
        }
    }
    
    public void testAddRewrite()
    {
        try
        {
            _rule.addRewriteRule("*.txt", "/replace");
            fail();
        } 
        catch (IllegalArgumentException e)
        {
        }
    }
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
miso-java-0.1.5 jetty/contrib/jetty-rewrite-handler/src/test/java/org/mortbay/jetty/handler/rewrite/LegacyRuleTest.java
miso-java-0.1.4 jetty/contrib/jetty-rewrite-handler/src/test/java/org/mortbay/jetty/handler/rewrite/LegacyRuleTest.java
miso-java-0.1.3 jetty/contrib/jetty-rewrite-handler/src/test/java/org/mortbay/jetty/handler/rewrite/LegacyRuleTest.java
miso-java-0.1.2 jetty/contrib/jetty-rewrite-handler/src/test/java/org/mortbay/jetty/handler/rewrite/LegacyRuleTest.java