Package org.springsource.loaded.test.infra

Examples of org.springsource.loaded.test.infra.Result


      getDeclaredMethod("bogus", String.class, int.class);
      fail("getting bogus method should fail");
    } catch (ResultException e) {
      assertNoSuchMethodException(TARGET_CLASS_NAME + ".bogus(java.lang.String, int)", e);
    }
    Result r = getDeclaredMethod("deleteThem", String.class, int.class);
    assertMethod("public java.lang.String " + TARGET_CLASS_NAME + ".deleteThem(java.lang.String,int)", r);

    reloadType("002");

    try {
View Full Code Here


  ////////////////////////////////////////////////////////////////////////////////////////////
  // Testing "invoke"

  private Result getDeclaredMethodAndInvoke(String name) throws Exception {
    Result r = getDeclaredMethod(name);
    return invoke((Method) r.returnValue);
  }
View Full Code Here

      assertNoSuchMethodException(TARGET_CLASS_NAME + ".lateMethod()", e);
    }

    reloadType("002");

    Result r = getDeclaredMethodAndInvoke("lateMethod");
    Assert.assertEquals(42, r.returnValue);
  }
View Full Code Here

   *
   * Can we retrieve and invoke a method that existed before we reloaded the type?
   */
  @Test
  public void test_getDeclaredMethodStaysAndInvoke() throws Exception {
    Result r = getDeclaredMethodAndInvoke("methodStays");
    Assert.assertEquals(99, r.returnValue);

    reloadType("002");

    r = getDeclaredMethodAndInvoke("methodStays");
View Full Code Here

   *
   * Can we retrieve and invoke a method that existed before we reloaded the type, and was deleted later.
   */
  @Test
  public void test_getDeclaredMethodDeletedAndInvoke() throws Exception {
    Result r = getDeclaredMethodAndInvoke("methodDeleted");
    Assert.assertEquals(37, r.returnValue);

    reloadType("002");

    try {
View Full Code Here

   * What happens if we invoke a cached Method object when the method it refers to was deleted?
   */
  @Test
  public void test_cacheGetDeclaredMethodDeletedAndInvoke() throws Exception {
    Method m = (Method) getDeclaredMethod("methodDeleted").returnValue;
    Result r = invoke(m);
    Assert.assertEquals(37, r.returnValue);

    reloadType("002");

    try {
View Full Code Here

   *
   * Can we retrieve and invoke a method that existed before we reloaded the type, and was changed later.
   */
  @Test
  public void test_getDeclaredMethodChangedAndInvoke() throws Exception {
    Result r = getDeclaredMethodAndInvoke("methodChanged");
    Assert.assertEquals(1, r.returnValue);

    reloadType("002");

    r = getDeclaredMethodAndInvoke("methodChanged");
View Full Code Here

      assertNoSuchMethodException(TARGET_CLASS_NAME + ".doubleIt(java.lang.String)", e);
    }

    reloadType("002");

    Result r = getDeclaredMethod("doubleIt", String.class);
    assertMethod("public java.lang.String " + TARGET_CLASS_NAME + ".doubleIt(java.lang.String)", r);

    r = invoke((Method) r.returnValue, "hi");
    Assert.assertEquals("hihi", r.returnValue);
  }
View Full Code Here

   *
   * A method with a parameter - existed at first - then it was changed
   */
  @Test
  public void test_getDeclaredMethod_param_Changed() throws Exception {
    Result r = getDeclaredMethod("changeIt", String.class);
    assertMethod("public java.lang.String " + TARGET_CLASS_NAME + ".changeIt(java.lang.String)", r);
    r = invoke((Method) r.returnValue, "hoho");
    Assert.assertEquals("hohoho!", r.returnValue);

    reloadType("002");
View Full Code Here

   *
   * A method with a parameter - existed at first - then it was changed: DIFFERENT RETURN TYPE
   */
  @Test
  public void test_getDeclaredMethod_param_ChangedReturnType() throws Exception {
    Result r = getDeclaredMethod("changeReturn", String.class);
    assertMethod("public java.lang.String " + TARGET_CLASS_NAME + ".changeReturn(java.lang.String)", r);
    r = invoke((Method) r.returnValue, "hoho");
    Assert.assertEquals("hohoho!", r.returnValue);

    reloadType("002");

    Result m = getDeclaredMethod("changeReturn", String.class);
    assertMethod("public int " + TARGET_CLASS_NAME + ".changeReturn(java.lang.String)", m);

    r = invoke((Method) m.returnValue, "hoho");
    Assert.assertEquals(4, r.returnValue);
  }
View Full Code Here

TOP

Related Classes of org.springsource.loaded.test.infra.Result

Copyright © 2018 www.massapicom. 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.