/** * 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); }
/** * Accuracy test for the constructor <code>DirectProjectMetadataKeyServiceImpl()</code>.<br> * Instance should be correctly created. */ @Test public void testCtor() { instance = new DirectProjectMetadataKeyServiceImpl(); assertNull( "'entityManager' should be correct.", TestsHelper.getField(instance, "entityManager")); assertNull("'logger' should be correct.", TestsHelper.getField(instance, "logger")); }
/** * Accuracy test for the method <code>getCommonProjectMetadataKeys()</code>.<br> * The result should be correct. * * @throws Exception to JUnit. */ @Test public void test_getCommonProjectMetadataKeys_2() throws Exception { TestsHelper.clearDB(em); List<DirectProjectMetadataKey> res = instance.getCommonProjectMetadataKeys(); assertEquals("'getCommonProjectMetadataKeys' should be correct.", 0, res.size()); }
/** * Accuracy test for the method <code>setDirectProjectMetadataKeyValidator( * DirectProjectMetadataKeyValidator directProjectMetadataKeyValidator)</code>.<br> * The value should be properly set. */ @Test public void test_setDirectProjectMetadataKeyValidator() { assertNotNull( "'setDirectProjectMetadataKeyValidator' should be correct.", TestsHelper.getField(instance, "directProjectMetadataKeyValidator")); }
/** * Cleans up the unit tests. * * @throws Exception to JUnit. */ @After public void tearDown() throws Exception { TestsHelper.clearDB(em); em = null; }