/** Test obtaining the TypeCode associated with a DynAny object. */
  public void testDynAnyTypeCode() {
    String msg;
    org.omg.CORBA.TypeCode tc = null;
    org.omg.DynamicAny.DynStruct dynAny = null;

    tc = orb.create_exception_tc(ID, NAME, MEMBERS);
    dynAny = createDynAnyFromTypeCode(tc);

    msg = "Incorrect TypeCode retrieved from DynAny::type operation";
    assertTrue(msg, dynAny.type().equal(tc));
  }
  /** Test destroying a DynAny object. */
  public void testDestroyDynAny() {
    String msg;
    EmptyException type;
    org.omg.CORBA.Any any = null;
    org.omg.DynamicAny.DynStruct dynAny = null;

    type = new EmptyException();
    any = orb.create_any();
    EmptyExceptionHelper.insert(any, type);
    dynAny = createDynAnyFromAny(any);
    dynAny.destroy();

    try {
      dynAny.type();

      msg = "Failed to destroy DynAny using DynAny::destroy operation - ";
      msg += "calling DynAny::type operation on a destroyed DynAny object ";
      msg += "did not raise OBJECT_NOT_EXIST exception";
      fail(msg);
    } catch (org.omg.CORBA.OBJECT_NOT_EXIST ex) {
      // success
    }

    msg = "Failed to destroy DynAny using DynAny::destroy operation - ";
    msg += "calling DynAny::current_component operation on a destroyed ";
    msg += "DynAny object did not raise OBJECT_NOT_EXIST exception";
    try {
      dynAny.current_component();

      fail(msg);
    } catch (org.omg.CORBA.OBJECT_NOT_EXIST ex) {
      // success
    } catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
      fail(msg + ": " + ex);
    }
  }