Hi,

can anyone commit this testcase for ObjectRegistry class

cheers !!

Sanka

*********************************************************
*********************************************************


package org.apache.bsf.test.utilTests;

import org.apache.bsf.util.ObjectRegistry;

import junit.framework.TestCase;

/**
 * This is a testcase for ObjectRegistry class
 *
 * @author Sanka Samaranayake <[EMAIL PROTECTED]>
 * @author Nilupa Bandara         <[EMAIL PROTECTED]>
 *
 */
public class ObjectRegistryTest extends TestCase {

        ObjectRegistry parent = null;
        ObjectRegistry child  = null;

        protected void setUp() throws Exception {
                createObjectRegistry();
                createObjectRegistryObjectRegistry();
        }

        /*
         * Class under test for void ObjectRegistry()
         */
        void createObjectRegistry() {
                parent = new ObjectRegistry();
                assertNotNull(parent);
        }

        /*
         * Class under test for void ObjectRegistry(ObjectRegistry)
         */
        void createObjectRegistryObjectRegistry() {
                child = new ObjectRegistry(parent);
                assertNotNull(child);
        }

        public void testRegister() {
                Integer foo = new Integer(0);

                try{
                        child.register("foo", foo);
                        assertEquals(child.lookup("foo"), foo);
                }catch(Exception ex){
                        fail(ex.getMessage());
                }
        }

        public void testLookup() {

                Integer foo = new Integer(0);

                try{
                        parent.register("foo", foo);
                        Integer bar = (Integer)child.lookup("foo");
                        assertEquals(bar, foo);
                }catch(Exception ex){
                        fail(ex.getMessage());
                }
        }

        public void testUnregister() {

                try{
                        child.register("foo", new Integer(0));
                        child.unregister("foo");
                        child.lookup("foo");
                        fail("should throw an IllegalArgumentException ..");
                }catch(Exception ex) {
                }
        }


}


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to