### Question:
FlowLogDBService implements FlowLogService { public void updateLastFlowLogPayload(FlowLog lastFlowLog, Payload payload, Map<Object, Object> variables) { String payloadJson = JsonWriter.objectToJson(payload, writeOptions); String variablesJson = JsonWriter.objectToJson(variables, writeOptions); Optional.ofNullable(lastFlowLog) .ifPresent(flowLog -> { flowLog.setPayload(payloadJson); flowLog.setVariables(variablesJson); flowLogRepository.save(flowLog); }); }  FlowLog save(FlowParameters flowParameters, String flowChanId, String key, Payload payload, Map<Object, Object> variables, Class<?> flowType,
            FlowState currentState); String getSerializedString(Object object); @Override Iterable<FlowLog> saveAll(Iterable<FlowLog> flowLogs); FlowLog close(Long stackId, String flowId); FlowLog cancel(Long stackId, String flowId); FlowLog terminate(Long stackId, String flowId); void saveChain(String flowChainId, String parentFlowChainId, Queue<Selectable> chain, String flowTriggerUserCrn); void updateLastFlowLogStatus(FlowLog lastFlowLog, boolean failureEvent); void cancelTooOldTerminationFlowForResource(Long resourceId, long olderThan); boolean isOtherNonTerminationFlowRunning(Long resourceId); boolean isOtherFlowRunning(Long resourceId); boolean repeatedFlowState(FlowLog lastFlowLog, String event); void updateLastFlowLogPayload(FlowLog lastFlowLog, Payload payload, Map<Object, Object> variables); Optional<FlowLog> getLastFlowLog(String flowId); @Override Set<String> findAllRunningNonTerminationFlowIdsByStackId(Long resourceId); @Override Optional<FlowLog> findFirstByFlowIdOrderByCreatedDesc(String flowId); @Override Optional<FlowChainLog> findFirstByFlowChainIdOrderByCreatedDesc(String flowChainId); @Override List<Object[]> findAllPending(); @Override Set<FlowLog> findAllUnassigned(); @Override Set<FlowLog> findAllByCloudbreakNodeId(String cloudbreakNodeId); List<FlowLog> findAllByResourceIdOrderByCreatedDesc(Long id); List<FlowLog> findAllByResourceIdAndFinalizedIsFalseOrderByCreatedDesc(Long id); @Override int purgeFinalizedFlowLogs(); List<FlowLog> findAllByFlowIdOrderByCreatedDesc(String flowId); Long getResourceIdByCrnOrName(String resource); FlowLog getLastFlowLogByResourceCrnOrName(String resource); List<FlowLog> getFlowLogsByResourceCrnOrName(String resource); Set<String> getFlowIdsByChainIds(Set<String> flowChainIds); List<FlowLog> getFlowLogsByFlowIdsCreatedDesc(Set<String> flowIds); Boolean hasPendingFlowEvent(List<FlowLog> flowLogs); Predicate<FlowLog> pendingFlowLogPredicate();  }### Answer:
@Test public void updateLastFlowLogPayload() { FlowLog flowLog = new FlowLog(); flowLog.setId(ID); Payload payload = mock(Selectable.class); Map<Object, Object> variables = Map.of("repeated", 2); underTest.updateLastFlowLogPayload(flowLog, payload, variables); ArgumentCaptor<FlowLog> flowLogCaptor = ArgumentCaptor.forClass(FlowLog.class); verify(flowLogRepository, times(1)).save(flowLogCaptor.capture()); FlowLog savedFlowLog = flowLogCaptor.getValue(); assertEquals(flowLog.getId(), savedFlowLog.getId()); String payloadJson = JsonWriter.objectToJson(payload, Map.of()); String variablesJson = JsonWriter.objectToJson(variables, Map.of()); assertEquals(payloadJson, savedFlowLog.getPayload()); assertEquals(variablesJson, savedFlowLog.getVariables()); }