/**
   * Sets up the unit tests.
   *
   * @throws Exception to JUnit.
   */
  @Before
  public void setUp() throws Exception {
    em = TestsHelper.getEntityManager();

    TestsHelper.clearDB(em);
    TestsHelper.loadDB(em);

    Map<String, Integer> auditActionTypeIdMap = new HashMap<String, Integer>();
    auditActionTypeIdMap.put("create", 1);
    auditActionTypeIdMap.put("update", 2);
    auditActionTypeIdMap.put("delete", 3);

    DirectProjectMetadataKeyValidatorImpl directProjectMetadataKeyValidator =
        new DirectProjectMetadataKeyValidatorImpl();
    directProjectMetadataKeyValidator.setEntityManager(em);
    directProjectMetadataKeyValidator.setLoggerName("loggerName");

    instance = new DirectProjectMetadataKeyServiceImpl();
    instance.setDirectProjectMetadataKeyValidator(directProjectMetadataKeyValidator);
    instance.setAuditActionTypeIdMap(auditActionTypeIdMap);
    instance.setEntityManager(em);
    instance.setLoggerName("loggerName");

    projectMetadataKey = new DirectProjectMetadataKey();
    projectMetadataKey.setName("name3");
    projectMetadataKey.setDescription("some text");
    projectMetadataKey.setGrouping(null);
    projectMetadataKey.setClientId(null);
    projectMetadataKey.setSingle(true);
  }
  /**
   * Failure test for the method <code>checkInitialization()</code> with entityManager is <code>null
   * </code>.<br>
   * <code>ConfigurationException</code> is expected.
   *
   * @throws Exception to JUnit.
   */
  @Test(expected = ConfigurationException.class)
  public void test_checkInitialization_entityManagerNull() throws Exception {
    instance.setEntityManager(null);

    instance.checkInitialization();
  }