Package java.beans

Examples of java.beans.Statement.execute()


     * The test checks the method execute() for setter
     */
    public void testSetter() throws Exception {
        Bean bean = new Bean();
        Statement s = new Statement(bean, "setText", new Object[] { "hello" });
        s.execute();
        assertEquals("hello", bean.getText());
    }

    /**
     * The test checks the method execute() for indexed setter
View Full Code Here


     */
    public void testIndexedSetter() throws Exception {
        Bean bean = new Bean("hello");
        Statement s = new Statement(bean, "setChar", new Object[] {
                new Integer(1), new Character('a') });
        s.execute();
        assertEquals("hallo", bean.getText());
    }

    /**
     * The test checks the method execute() for array setter
View Full Code Here

     */
    public void testArraySetter() throws Exception {
        int[] a = { 1, 2, 3 };
        Statement s = new Statement(a, "set", new Object[] { new Integer(1),
                new Integer(7) });
        s.execute();
        assertEquals(7, a[1]);
    }

    /**
     * The test checks the method execute() for static method
View Full Code Here

     */
    public void testStatic() throws Exception {
        int currentId = getTestId();
        Statement s = new Statement(StatementTest.class, "nextTestId",
                new Object[] {});
        s.execute();
        assertEquals(++currentId, getTestId());
    }

    /**
     * The test checks the method execute() if exception is thrown on method
View Full Code Here

        Bean bean = new Bean("hello");
        Statement s = new Statement(bean, "setChar", new Object[] {
                new Integer(5), new Character('a') });

        try {
            s.execute();
            fail("Exception must be thrown while Bean.setChar(5, 'a') "
                    + "invocation.");
        } catch (Exception e) {
            // correct situation
        }
View Full Code Here

    public void testExceptionThrownOnStaticMethodCall() throws Exception {
        Statement s = new Statement(StatementTest.class, "methodWithException",
                new Object[] {});

        try {
            s.execute();
            fail("Exception must be thrown with methodWithException call");
        } catch (SampleException se) {
            // SampleException is thrown as expected
        }
    }
View Full Code Here

     * The test checks the method execute() with array as parameter
     */
    public void testMethodWithArrayParam() throws Exception {
        Statement s = new Statement(StatementTest.class, "methodWithIntArray",
                new Object[] { new int[] { 3 } });
        s.execute();
    }

    /**
     *
     */
 
View Full Code Here

        try {
          // TODO: this is just a temporary injection solution
          // TODO: test for the existence of the setter before attempting it
          // TODO: avoid exception throwing when there is no setter
          stmt = new Statement(contributor, "set" + serviceName, new Object[]{gatewayServices.getService(serviceName)});
          stmt.execute();
        } catch (NoSuchMethodException e) {
          // TODO: eliminate the possibility of this being thrown up front
        } catch (Exception e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
View Full Code Here

     * The test checks the method execute() for setter
     */
    public void testSetter() throws Exception {
        Bean bean = new Bean();
        Statement s = new Statement(bean, "setText", new Object[] { "hello" });
        s.execute();
        assertEquals("hello", bean.getText());
    }

    /**
     * The test checks the method execute() for indexed setter
View Full Code Here

     */
    public void testIndexedSetter() throws Exception {
        Bean bean = new Bean("hello");
        Statement s = new Statement(bean, "setChar", new Object[] {
                new Integer(1), new Character('a') });
        s.execute();
        assertEquals("hallo", bean.getText());
    }

    /**
     * The test checks the method execute() for array setter
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.