### Question:
CategoryServiceImpl implements CategoryService { @Override public Category save(CategoryDto dto) { log.info(LogMessage.IN_SAVE); Category byName = categoryRepo.findByName(dto.getName()); if (byName != null) { throw new BadCategoryRequestException( ErrorMessage.CATEGORY_ALREADY_EXISTS_BY_THIS_NAME); } return categoryRepo.save(Category.builder().name(dto.getName()).build()); }  @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();  }### Answer:
@Test public void saveTest() { Category genericEntity = new Category(); when(categoryRepo.save(genericEntity)).thenReturn(genericEntity); assertEquals(genericEntity, categoryService.save(genericEntity)); }
@Test public void saveDtoTest() { CategoryDto genericDto = CategoryDto.builder().name("Test").build(); Category genericEntity = Category.builder().name("Test").build(); when(categoryService.save(genericDto)).thenReturn(genericEntity); assertEquals(genericEntity, categoryService.save(genericDto)); }