//////////////////////////////////////////////////////////
  // TEST: (valid) testJoinFederationWithTypeAndModules() //
  //////////////////////////////////////////////////////////
  @Test
  public void testJoinFederationWithTypeAndModules() {
    // join the base federate to the federation
    defaultFederate.quickJoin();

    // validate that we don't have any information about the model the second federate
    // will add when it joins
    defaultFederate.quickOCHandleMissing("HLAobjectRoot.Employee.Waiter");
    defaultFederate.quickICHandleMissing("HLAinteractionRoot.CustomerTransactions.FoodServed");
    defaultFederate.quickOCHandleMissing("HLAobjectRoot.Food.SideDish.Corn");

    try {
      // try and join a federation with mode modules
      URL[] modules =
          new URL[] {
            ClassLoader.getSystemResource("fom/ieee1516e/restaurant/RestaurantProcesses.xml"),
            ClassLoader.getSystemResource("fom/ieee1516e/restaurant/RestaurantFood.xml"),
          };

      secondFederate.rtiamb.joinFederationExecution(
          secondFederate.federateName, secondFederate.simpleName, modules);
    } catch (Exception e) {
      // clean up for the next test //
      defaultFederate.quickResign();
      secondFederate.quickResignTolerant();
      Assert.fail("Failed while testing a valid join request with modules", e);
    }

    defaultFederate.quickTick();
    secondFederate.quickTick();

    // validate that the default federate now fetch information about the extended FOM
    // classes from RestaurantProcess.xml
    int handleA = defaultFederate.quickOCHandle("HLAobjectRoot.Employee.Waiter");
    int handleB = secondFederate.quickOCHandle("HLAobjectRoot.Employee.Waiter");
    Assert.assertEquals(handleB, handleA);

    handleA = defaultFederate.quickICHandle("HLAinteractionRoot.CustomerTransactions.FoodServed");
    handleB = secondFederate.quickICHandle("HLAinteractionRoot.CustomerTransactions.FoodServed");
    Assert.assertEquals(handleB, handleA);

    // classes from RestaurantFood.xml
    handleA = defaultFederate.quickOCHandle("HLAobjectRoot.Food.SideDish.Corn");
    handleB = secondFederate.quickOCHandle("HLAobjectRoot.Food.SideDish.Corn");
    Assert.assertEquals(handleB, handleA);
  }
  ///////////////////////////////////////////////////////
  // TEST: testJoinFederationWhereFederateNameExists() //
  ///////////////////////////////////////////////////////
  @Test
  public void testJoinFederationWhereFederateNameExists() {
    defaultFederate.quickJoin();

    // try and join a second federate with the same name //
    try {
      TestFederate otherFederate = new TestFederate("otherFederate", this);
      otherFederate.quickConnect();
      otherFederate.rtiamb.joinFederationExecution(
          defaultFederate.federateName, defaultFederate.federateType, defaultFederate.simpleName);
      Assert.fail("No exception while joining federation where name is taken");
    } catch (FederateAlreadyExecutionMember aem) {
      // SUCCESS
    } catch (Exception e) {
      Assert.fail("Invalid exception while joining federation where name is taken", e);
    } finally {
      defaultFederate.quickResign();
    }
  }
 @AfterClass(alwaysRun = true)
 public void afterClass() {
   secondFederate.quickDisconnect();
   super.afterClass();
 }
 @AfterMethod(alwaysRun = true)
 public void afterMethod() {
   defaultFederate.quickResignTolerant();
   secondFederate.quickResignTolerant();
   defaultFederate.quickDestroy();
 }