KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > nanocontainer > script > UnsupportedScriptTypeExceptionTestCase


1 package org.nanocontainer.script;
2
3 import junit.framework.*;
4
5 /**
6  * Exception Tests.
7  * @author Michael Rimov
8  */

9 public class UnsupportedScriptTypeExceptionTestCase extends TestCase {
10     private UnsupportedScriptTypeException unsupportedScriptTypeException = null;
11
12     private final String JavaDoc[] supportedParams = new String JavaDoc[]{".groovy",".py",".xml"};
13
14     protected void setUp() throws Exception JavaDoc {
15         super.setUp();
16         unsupportedScriptTypeException = new UnsupportedScriptTypeException("test.txt", supportedParams);
17     }
18
19     protected void tearDown() throws Exception JavaDoc {
20         unsupportedScriptTypeException = null;
21         super.tearDown();
22     }
23
24     public void testGetMessage() {
25         String JavaDoc actualReturn = unsupportedScriptTypeException.getMessage();
26         assertNotNull(actualReturn);
27         assertTrue(actualReturn.indexOf(".groovy") > -1);
28         assertTrue(actualReturn.indexOf(".py") > -1) ;
29         assertTrue(actualReturn.indexOf(".xml") > -1);
30         assertTrue(actualReturn.indexOf("test.txt") > -1);
31     }
32
33     public void testGetRequestedExtension() {
34         String JavaDoc expectedReturn = "test.txt";
35         String JavaDoc actualReturn = unsupportedScriptTypeException.getRequestedExtension();
36         assertEquals("return value", expectedReturn, actualReturn);
37     }
38
39     public void testGetSystemSupportedExtensions() {
40         String JavaDoc[] expectedReturn = supportedParams;
41         String JavaDoc[] actualReturn = unsupportedScriptTypeException.getSystemSupportedExtensions();
42         assertEquals("return value", expectedReturn, actualReturn);
43     }
44
45
46 }
47
Popular Tags