### Question:
SpecificationServiceImpl implements SpecificationService { @Override public Long deleteById(Long id) { log.info(LogMessage.IN_DELETE_BY_ID, id); specificationRepo.delete(findById(id)); return id; }  @Override Specification save(Specification specification); @Override Specification findById(Long id); @Override List<Specification> findAll(); @Override Long deleteById(Long id); @Override Specification findByName(String specificationName); @Override List<SpecificationNameDto> findAllSpecificationDto();  }### Answer:
@Test void deleteByIdTest() { when(specificationRepo.findById(anyLong())).thenReturn(Optional.of(new Specification())); assertEquals(new Long(1), specificationService.deleteById(1L)); }
@Test void deleteByIdGivenIdNullThenThrowException() { assertThrows(NotFoundException.class, () -> { specificationService.deleteById(null); }); }