DrawingOfficerService implements EntityTypeService { public DrawingOfficer getDrawingOfficerByName(final String name) { return drawingOfficerRepository.findByName(name); } @Autowired  DrawingOfficerService(final DrawingOfficerRepository drawingOfficerRepository); List<DrawingOfficer> getAllDrawingOfficers(); DrawingOfficer findById(Long id); DrawingOfficer getDrawingOfficerByName(final String name); DrawingOfficer getDrawingOfficerByCode(final String code); DrawingOfficer getDrawingOfficerByPosition(final Long posId); List<DrawingOfficer> getListOfDrawingOfficersByNameLike(final String name); List<DrawingOfficer> getListOfDrawingOfficerByCodeLike(final String code); @Transactional void create(final DrawingOfficer officer); @Transactional void update(final DrawingOfficer officer); @Transactional void delete(final DrawingOfficer officer); @Override List<EntityType> getAllActiveEntities(Integer accountDetailTypeId); @Override List<? extends EntityType> filterActiveEntities(String filterKey, int maxRecords, Integer accountDetailTypeId); @Override List getAssetCodesForProjectCode(Integer accountdetailkey); @Override List<EntityType> validateEntityForRTGS(List<Long> idsList); @Override List<EntityType> getEntitiesById(List<Long> idsList);  }
@Test public void findByName() { when(drawingOfficerRepository.findByName(drawingOfficer.getName())).thenReturn(drawingOfficer); assertEquals("test-do", drawingOfficerService.getDrawingOfficerByName("test-do").getName()); }