    001    package org.nanocontainer.script;
    002
    003    import junit.framework.*;
    004
    005    /**
    006     * Exception Tests.
    007     * @author Michael Rimov
    008     */
    009    public class UnsupportedScriptTypeExceptionTestCase extends TestCase {
    010        private UnsupportedScriptTypeException unsupportedScriptTypeException = null;
    011
    012        private final String[] supportedParams = new String[]{".groovy",".py",".xml"};
    013
    014        protected void setUp() throws Exception {
    015            super.setUp();
    016            unsupportedScriptTypeException = new UnsupportedScriptTypeException("test.txt", supportedParams);
    017        }
    018
    019        protected void tearDown() throws Exception {
    020            unsupportedScriptTypeException = null;
    021            super.tearDown();
    022        }
    023
    024        public void testGetMessage() {
    025            String actualReturn = unsupportedScriptTypeException.getMessage();
    026            assertNotNull(actualReturn);
    027            assertTrue(actualReturn.indexOf(".groovy") > -1);
    028            assertTrue(actualReturn.indexOf(".py") > -1) ;
    029            assertTrue(actualReturn.indexOf(".xml") > -1);
    030            assertTrue(actualReturn.indexOf("test.txt") > -1);
    031        }
    032
    033        public void testGetRequestedExtension() {
    034            String expectedReturn = "test.txt";
    035            String actualReturn = unsupportedScriptTypeException.getRequestedExtension();
    036            assertEquals("return value", expectedReturn, actualReturn);
    037        }
    038
    039        public void testGetSystemSupportedExtensions() {
    040            String[] expectedReturn = supportedParams;
    041            String[] actualReturn = unsupportedScriptTypeException.getSystemSupportedExtensions();
    042            assertEquals("return value", expectedReturn, actualReturn);
    043        }
    044
    045
    046    }