Diff for BSFTest.java class ____________________________
--- BSFTest_Orig.java 2004-04-27 09:56:34.000000000 +0600 +++ BSFTest.java 2004-05-07 15:13:02.000000000 +0600 @@ -8,6 +8,7 @@ import org.apache.bsf.BSFManager; import org.apache.bsf.test.engineTests.*; +import org.apache.bsf.test.utilTests.BSFFunctionsTest; /** * Primary test class and testing front end for BSF. @@ -41,7 +42,7 @@ * Please add testcases here as needed. */ TestSuite suite = new TestSuite(); - testNames = new String [4]; + testNames = new String [5]; suite.addTestSuite(BSFTest.class); testNames[0] = "BSFManager Base Tests"; @@ -51,6 +52,8 @@ testNames[2] = "Rhino Engine Tests"; suite.addTestSuite(jythonTest.class); testNames[3] = "Jython Engine Tests"; + suite.addTestSuite(BSFFunctionsTest.class); + testNames[4] = "BSFFunctions Tests"; return suite; } ______________________________________________________ package org.apache.bsf.test.utilTests; /** * Testcase for BSFFunctions class * @author thusitha perera <[EMAIL PROTECTED]> */ import junit.framework.TestCase; import org.apache.bsf.*; import org.apache.bsf.util.*; import org.apache.bsf.engines.javascript.*; public class BSFFunctionsTest extends TestCase { protected BSFManager mgr; protected BSFFunctions testObj ; protected BSFEngine eng ; Object result ; protected void setUp() throws Exception { super.setUp(); mgr = new BSFManager(); eng = new JavaScriptEngine(); testObj = new BSFFunctions(mgr, eng); String string = new String("test"); testObj.registerBean("string1", string); } protected void tearDown() throws Exception { super.tearDown(); mgr.terminate(); } final public void testAddEventListener() throws Exception { result = mgr.eval("javascript", "script", 0, 0,"var integer = 1;"+ "f = new java.awt.Frame (\"Test Frame\");"+ "bsf.addEventListener (f, \"window\", \"windowDeactivated\", \"testfun ()\");"+ "function testfun () {" + "integer += 1;"+ "java.lang.System.err.println(integer);" + "}" + "f.setVisible(true);"+"f.setVisible(false);"+"integer ;"); assertEquals(true,Double.parseDouble(result.toString())== 2.0 ); } final public void testLookupBean() { assertEquals("test", mgr.lookupBean("string1")); } final public void testRegisterBean() { assertEquals("test", mgr.lookupBean("string1")); } final public void testUnregisterBean() { String str = new String("unregister"); testObj.registerBean("string2", str); testObj.unregisterBean("string2"); assertEquals(null, mgr.lookupBean("string2")); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]