@Test void createInfo() { when(userMgmtRestClient.getUser()).thenReturn(ResponseEntity.ok(getUser(UserRoleTO.STAFF))); when(infoMapper.toOperationInfoEntity(any())).thenAnswer(a -> MAPPER.toOperationInfoEntity(a.getArgument(0))); OperationInfo result = service.createInfo(getInfo().iterator().next()); ArgumentCaptor<OperationInfoEntity> captor = ArgumentCaptor.forClass(OperationInfoEntity.class); verify(infoRepository, times(1)).save(captor.capture()); assertEquals("branchId", captor.getValue().getTppId()); }
public OperationInfo createInfo(OperationInfo operationInfo) { String tppId = validateAndGetTppId(); operationInfo.setTppId(tppId); OperationInfoEntity infoEntity = infoMapper.toOperationInfoEntity(operationInfo); return infoMapper.toOperationInfo(infoRepository.save(infoEntity)); }
TppOperationInfoService { public OperationInfo createInfo(OperationInfo operationInfo) { String tppId = validateAndGetTppId(); operationInfo.setTppId(tppId); OperationInfoEntity infoEntity = infoMapper.toOperationInfoEntity(operationInfo); return infoMapper.toOperationInfo(infoRepository.save(infoEntity)); } }
TppOperationInfoService { public OperationInfo createInfo(OperationInfo operationInfo) { String tppId = validateAndGetTppId(); operationInfo.setTppId(tppId); OperationInfoEntity infoEntity = infoMapper.toOperationInfoEntity(operationInfo); return infoMapper.toOperationInfo(infoRepository.save(infoEntity)); }  }
TppOperationInfoService { public OperationInfo createInfo(OperationInfo operationInfo) { String tppId = validateAndGetTppId(); operationInfo.setTppId(tppId); OperationInfoEntity infoEntity = infoMapper.toOperationInfoEntity(operationInfo); return infoMapper.toOperationInfo(infoRepository.save(infoEntity)); }  List<OperationInfo> getOperationsByTypeAndTppId(OperationType operationType); OperationInfo createInfo(OperationInfo operationInfo); void deleteInfo(Long operationInfoId); }
TppOperationInfoService { public OperationInfo createInfo(OperationInfo operationInfo) { String tppId = validateAndGetTppId(); operationInfo.setTppId(tppId); OperationInfoEntity infoEntity = infoMapper.toOperationInfoEntity(operationInfo); return infoMapper.toOperationInfo(infoRepository.save(infoEntity)); }  List<OperationInfo> getOperationsByTypeAndTppId(OperationType operationType); OperationInfo createInfo(OperationInfo operationInfo); void deleteInfo(Long operationInfoId);  }