/**
   * Test the {@link MilitaryAffiliationController#create(MilitaryAffiliationTO)} and {@link
   * MilitaryAffiliationController#delete(UUID)} actions.
   *
   * @throws ObjectNotFoundException If lookup data can not be found.
   * @throws ValidationException If there are any validation errors.
   */
  @Test
  public void testControllerCreateAndDelete() throws ObjectNotFoundException, ValidationException {
    assertNotNull(
        "Controller under test was not initialized by the container correctly.", controller);

    // Check validation of 'no ID for create()'
    try {
      controller.create(new MilitaryAffiliationTO(UUID.randomUUID(), TEST_STRING1, TEST_STRING2));
      fail(
          "Calling create with an object with an ID should have thrown a validation excpetion."); // NOPMD
    } catch (final ValidationException exc) { // NOPMD
      /* expected */
    }

    // Now create a valid MilitaryAffiliation
    final MilitaryAffiliationTO saved =
        controller.create(new MilitaryAffiliationTO(null, TEST_STRING1, TEST_STRING2));

    assertNotNull(
        "Returned MilitaryAffiliationTO from the controller should not have been null.", saved);
    assertNotNull(
        "Returned MilitaryAffiliationTO.ID from the controller should not have been null.",
        saved.getId());
    assertEquals(
        "Returned MilitaryAffiliationTO.Name from the controller did not match.",
        TEST_STRING1,
        saved.getName());
    assertEquals(
        "Returned MilitaryAffiliationTO.CreatedBy was not correctly auto-filled for the current user (the administrator in this test suite).",
        Person.SYSTEM_ADMINISTRATOR_ID,
        saved.getCreatedBy().getId());

    assertTrue(
        "Delete action did not return success.", controller.delete(saved.getId()).isSuccess());
  }
  /**
   * Test the {@link MilitaryAffiliationController#get(UUID)} action.
   *
   * @throws ObjectNotFoundException If lookup data can not be found.
   * @throws ValidationException If there are any validation errors.
   */
  @Test
  public void testControllerGet() throws ObjectNotFoundException, ValidationException {
    assertNotNull(
        "Controller under test was not initialized by the container correctly.", controller);

    final MilitaryAffiliationTO obj = controller.get(MILITARY_AFFILIATION_ID);

    assertNotNull(
        "Returned MilitaryAffiliationTO from the controller should not have been null.", obj);

    assertEquals(
        "Returned MilitaryAffiliation.Name did not match.",
        MILITARY_AFFILIATION_NAME,
        obj.getName());
  }