Examples of ThrowableAnalyzer


Examples of org.springframework.security.web.util.ThrowableAnalyzer

       this.testTrace[2] = new NonStandardException("Test_2", this.testTrace[3]);
       this.testTrace[1] = new RuntimeException("Test_1", this.testTrace[2]);
       this.testTrace[0] = new Exception("Test_0", this.testTrace[1]);

       // Set up standard analyzer
       this.standardAnalyzer = new ThrowableAnalyzer();

       // Set up nonstandard analyzer
       this.nonstandardAnalyzer = new ThrowableAnalyzer() {
           /**
            * @see org.springframework.security.web.util.ThrowableAnalyzer#initExtractorMap()
            */
           @Override
           protected void initExtractorMap() {
View Full Code Here

Examples of org.springframework.security.web.util.ThrowableAnalyzer

        super.tearDown();
    }

    public void testRegisterExtractorWithInvalidExtractor() {
        try {
            new ThrowableAnalyzer() {

                /**
                 * @see org.springframework.security.web.util.ThrowableAnalyzer#initExtractorMap()
                 */
                @Override
View Full Code Here

Examples of org.springframework.security.web.util.ThrowableAnalyzer

            }
        }
    }

    public void testDetermineCauseChainWithNoExtractors() {
        ThrowableAnalyzer analyzer = new ThrowableAnalyzer() {

            /**
             * @see org.springframework.security.web.util.ThrowableAnalyzer#initExtractorMap()
             */
            @Override
            protected void initExtractorMap() {
                // skip default initialization
            }
        };

        assertEquals("Unexpected number of registered types", 0, analyzer.getRegisteredTypes().length);

        Throwable t = this.testTrace[0];
        Throwable[] chain = analyzer.determineCauseChain(t);
        // Without extractors only the root throwable is available
        assertEquals("Unexpected chain size", 1, chain.length);
        assertEquals("Unexpected chain entry", t, chain[0]);
    }
View Full Code Here

Examples of org.springframework.security.web.util.ThrowableAnalyzer

        assertEquals("Unexpected chain size", 1, chain.length);
        assertEquals("Unexpected chain entry", t, chain[0]);
    }

    public void testDetermineCauseChainWithDefaultExtractors() {
        ThrowableAnalyzer analyzer = this.standardAnalyzer;

        assertEquals("Unexpected number of registered types", 2, analyzer.getRegisteredTypes().length);

        Throwable[] chain = analyzer.determineCauseChain(this.testTrace[0]);

        // Element at index 2 is a NonStandardException which cannot be analyzed further by default
        assertEquals("Unexpected chain size", 3, chain.length);
        for (int i = 0; i < 3; ++i) {
            assertEquals("Unexpected chain entry: " + i, this.testTrace[i], chain[i]);
View Full Code Here

Examples of org.springframework.security.web.util.ThrowableAnalyzer

            assertEquals("Unexpected chain entry: " + i, this.testTrace[i], chain[i]);
        }
    }

    public void testDetermineCauseChainWithCustomExtractors() {
        ThrowableAnalyzer analyzer = this.nonstandardAnalyzer;

        Throwable[] chain = analyzer.determineCauseChain(this.testTrace[0]);

        assertEquals("Unexpected chain size", this.testTrace.length, chain.length);
        for (int i = 0; i < chain.length; ++i) {
            assertEquals("Unexpected chain entry: " + i, this.testTrace[i], chain[i]);
        }
View Full Code Here

Examples of org.springframework.security.web.util.ThrowableAnalyzer

            assertEquals("Unexpected chain entry: " + i, this.testTrace[i], chain[i]);
        }
    }

    public void testGetFirstThrowableOfTypeWithSuccess1() {
        ThrowableAnalyzer analyzer = this.nonstandardAnalyzer;

        Throwable[] chain = analyzer.determineCauseChain(this.testTrace[0]);

        Throwable result = analyzer.getFirstThrowableOfType(Exception.class, chain);

        assertNotNull("null not expected", result);
        assertEquals("Unexpected throwable found", this.testTrace[0], result);
    }
View Full Code Here

Examples of org.springframework.security.web.util.ThrowableAnalyzer

        assertNotNull("null not expected", result);
        assertEquals("Unexpected throwable found", this.testTrace[0], result);
    }

    public void testGetFirstThrowableOfTypeWithSuccess2() {
        ThrowableAnalyzer analyzer = this.nonstandardAnalyzer;

        Throwable[] chain = analyzer.determineCauseChain(this.testTrace[0]);

        Throwable result = analyzer.getFirstThrowableOfType(NonStandardException.class, chain);

        assertNotNull("null not expected", result);
        assertEquals("Unexpected throwable found", this.testTrace[2], result);
    }
View Full Code Here

Examples of org.springframework.security.web.util.ThrowableAnalyzer

        assertNotNull("null not expected", result);
        assertEquals("Unexpected throwable found", this.testTrace[2], result);
    }

    public void testGetFirstThrowableOfTypeWithFailure() {
        ThrowableAnalyzer analyzer = this.nonstandardAnalyzer;

        Throwable[] chain = analyzer.determineCauseChain(this.testTrace[0]);

        // IllegalStateException not in trace
        Throwable result = analyzer.getFirstThrowableOfType(IllegalStateException.class, chain);

        assertNull("null expected", result);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.