@Test public void findByNameTest() { Category genericEntity = new Category(); when(categoryRepo.findByName(any())).thenReturn(genericEntity); Category foundEntity = categoryService.findByName(any()); assertEquals(genericEntity, foundEntity); }
@Override public Category findByName(String name) { Category category = categoryRepo.findByName(name); if (category == null) { throw new NotFoundException(ErrorMessage.CATEGORY_NOT_FOUND_BY_NAME + name); } return categoryRepo.findByName(name); }
CategoryServiceImpl implements CategoryService { @Override public Category findByName(String name) { Category category = categoryRepo.findByName(name); if (category == null) { throw new NotFoundException(ErrorMessage.CATEGORY_NOT_FOUND_BY_NAME + name); } return categoryRepo.findByName(name); } }
CategoryServiceImpl implements CategoryService { @Override public Category findByName(String name) { Category category = categoryRepo.findByName(name); if (category == null) { throw new NotFoundException(ErrorMessage.CATEGORY_NOT_FOUND_BY_NAME + name); } return categoryRepo.findByName(name); }  }
CategoryServiceImpl implements CategoryService { @Override public Category findByName(String name) { Category category = categoryRepo.findByName(name); if (category == null) { throw new NotFoundException(ErrorMessage.CATEGORY_NOT_FOUND_BY_NAME + name); } return categoryRepo.findByName(name); }  @Override Category save(CategoryDto dto); @Override Category save(Category category); @Override List<Category> findAll(); @Override Category findById(Long id); @Override Category update(Long id, Category category); @Override Long deleteById(Long id); @Override Category findByName(String name); @Override List<CategoryDto> findAllCategoryDto(); }
CategoryServiceImpl implements CategoryService { @Override public Category findByName(String name) { Category category = categoryRepo.findByName(name); if (category == null) { throw new NotFoundException(ErrorMessage.CATEGORY_NOT_FOUND_BY_NAME + name); } return categoryRepo.findByName(name); }  @Override Category save(CategoryDto dto); @Override Category save(Category category); @Override List<Category> findAll(); @Override Category findById(Long id); @Override Category update(Long id, Category category); @Override Long deleteById(Long id); @Override Category findByName(String name); @Override List<CategoryDto> findAllCategoryDto();  }