@Test public void shouldGetCategoryByUrlAndProject() { Project zeng = new Project("Zeng"); session.save(zeng); Category category = new Category(zeng, "back-end"); categoryDao.insert(category); Category gotCategory = categoryDao.getCategoryWithUrlAndProject("back-end", "zeng"); assertTrue(gotCategory.getUrl().equals(category.getUrl())); }
@Test public void shouldReturnACategoryById() { Project zeng = new Project("Zeng"); session.save(zeng); Category test = new Category(zeng, "test category"); categoryDao.insert(test); Category categoryComplete = categoryDao.getCategoryWithId(test.getId()); assertNotNull(categoryComplete); assertEquals(test.getName(), categoryComplete.getName()); }