@Test public void testCreateCategory() { String name = "testCreateCategory"; Long id = categoryService.createCategory(name); assertNotNull(id); }
public Long createCategory(String name){ Category category = new Category(); category.setName(name); em.persist(category); return category.getId(); }
CategoryService { public Long createCategory(String name){ Category category = new Category(); category.setName(name); em.persist(category); return category.getId(); } }
CategoryService { public Long createCategory(String name){ Category category = new Category(); category.setName(name); em.persist(category); return category.getId(); }  }
CategoryService { public Long createCategory(String name){ Category category = new Category(); category.setName(name); em.persist(category); return category.getId(); }  Long createCategory(String name); Long createSubCategory(long parentId, String name); List<Category> getAllCategories(boolean withSub); Category getCategory(long id, boolean withSub); SubCategory getSubCategory(long id); }
CategoryService { public Long createCategory(String name){ Category category = new Category(); category.setName(name); em.persist(category); return category.getId(); }  Long createCategory(String name); Long createSubCategory(long parentId, String name); List<Category> getAllCategories(boolean withSub); Category getCategory(long id, boolean withSub); SubCategory getSubCategory(long id);  }