@Test void findByNameTest() { Specification genericEntity = new Specification(); when(specificationRepo.findByName(anyString())).thenReturn(Optional.of(genericEntity)); Specification foundEntity = specificationService.findByName(anyString()); assertEquals(genericEntity, foundEntity); }
@Override public Specification findByName(String specificationName) { return specificationRepo .findByName(specificationName) .orElseThrow(() -> new NotFoundException(ErrorMessage.SPECIFICATION_NOT_FOUND_BY_NAME)); }
SpecificationServiceImpl implements SpecificationService { @Override public Specification findByName(String specificationName) { return specificationRepo .findByName(specificationName) .orElseThrow(() -> new NotFoundException(ErrorMessage.SPECIFICATION_NOT_FOUND_BY_NAME)); } }
SpecificationServiceImpl implements SpecificationService { @Override public Specification findByName(String specificationName) { return specificationRepo .findByName(specificationName) .orElseThrow(() -> new NotFoundException(ErrorMessage.SPECIFICATION_NOT_FOUND_BY_NAME)); }  }
SpecificationServiceImpl implements SpecificationService { @Override public Specification findByName(String specificationName) { return specificationRepo .findByName(specificationName) .orElseThrow(() -> new NotFoundException(ErrorMessage.SPECIFICATION_NOT_FOUND_BY_NAME)); }  @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(); }
SpecificationServiceImpl implements SpecificationService { @Override public Specification findByName(String specificationName) { return specificationRepo .findByName(specificationName) .orElseThrow(() -> new NotFoundException(ErrorMessage.SPECIFICATION_NOT_FOUND_BY_NAME)); }  @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();  }