private PathMatchingFilter createTestInstance() {
        final String name = "pathMatchingFilter";

        PathMatchingFilter filter = new PathMatchingFilter() {

            @Override
            protected boolean isEnabled(ServletRequest request, ServletResponse response,
                                        String path, Object mappedValue) throws Exception {
                return !path.equals(DISABLED_PATH);
            }

            @Override
            protected boolean onPreHandle(ServletRequest request, ServletResponse response, Object mappedValue) throws Exception {
                //simulate a subclass that handles the response itself (A 'false' return value indicates that the
                //FilterChain should not continue to be executed)
                //
                //This method should only be called if the filter is enabled, so we know if the return value is
                //false, then the filter was enabled.  A true return value from 'onPreHandle' indicates this test
                //filter was disabled or a path wasn't matched.
                return false;
            }
        };
        filter.setName(name);

        return filter;
    }
Tests the following assumptions:

<pre>
URL                 Must match pattern      Must not match pattern
/foo/               /foo/*                  /foo* || /foo
/foo/bar            /foo/*                  /foo* || /foo
/foo                /foo                    /foo/*
</pre>
web/src/test/java/org/apache/shiro/web/filter/PathMatchingFilterParameterizedTest.java