ComplaintTypeService { @Transactional public ComplaintType createComplaintType(ComplaintType complaintType) { return complaintTypeRepository.save(complaintType); } @Autowired  ComplaintTypeService(ComplaintTypeRepository complaintTypeRepository); ComplaintType findBy(Long complaintTypeId); @Transactional ComplaintType createComplaintType(ComplaintType complaintType); @Transactional ComplaintType updateComplaintType(ComplaintType complaintType); List<ComplaintType> findAll(); List<ComplaintType> findAllActiveByNameLike(String name); List<ComplaintType> findActiveComplaintTypesByCategory(Long categoryId); ComplaintType findByName(String name); ComplaintType load(Long id); @ReadOnly Page<ComplaintType> getComplaintType(DataTableSearchRequest request); @ReadOnly List<ComplaintType> getFrequentlyFiledComplaints(); ComplaintType findByCode(final String code); List<ComplaintType> findActiveComplaintTypes(); List<String> getActiveComplaintTypeCode(); List<ComplaintType> getComplaintTypeByDepartmentId(Long departmentId);  }
@Test public void shouldIndexAfterCreating() { ComplaintType complaintType = new ComplaintTypeBuilder().withDefaults().withName("Roads").build(); complaintTypeService.createComplaintType(complaintType); verify(complaintTypeRepository).save(complaintType); }