### Question:
CDPStructuredEventEntityToCDPStructuredEventConverter extends AbstractConversionServiceAwareConverter<CDPStructuredEventEntity, CDPStructuredEvent> { @Override public CDPStructuredEvent convert(CDPStructuredEventEntity source) { try { JsonNode jsonNode = JsonUtil.readTree(source.getStructuredEventJson().getValue()); String eventType = jsonNode.path(CDPStructuredEvent.TYPE_FIELD).textValue(); Class<? extends CDPStructuredEvent> eventClass = classes.get(eventType); if (eventClass == null) { String msg = String.format("Cannot convert structured event entity to type: '%s (%s)' structured event.", source.getEventType(), eventType); LOGGER.info(msg); throw new CloudbreakServiceException(msg); } return JsonUtil.treeToValue(jsonNode, eventClass); } catch (CloudbreakServiceException e) { throw e; } catch (Exception e) { String msg = String.format("Error occurred during the structured event conversion: '%s (%s)'", source.getEventType(), source.getClass().getSimpleName()); LOGGER.error(msg, e); throw new CloudbreakServiceException(msg, e); } }  @PostConstruct void init(); @Override CDPStructuredEvent convert(CDPStructuredEventEntity source);  }### Answer:
@Test public void testConvertWhenSuccess() { CDPOperationDetails operationDetails = new CDPOperationDetails(); operationDetails.setAccountId("accountId"); FlowDetails flowDetails = new FlowDetails(); Serializable payload = "payload"; CDPStructuredEvent event = new CDPStructuredFlowEvent(operationDetails, flowDetails, payload, null, null); CDPStructuredEventEntity eventEntity = new CDPStructuredEventEntity(); eventEntity.setEventType(StructuredEventType.FLOW); eventEntity.setStructuredEventJson(new Json(event)); CDPStructuredFlowEvent<String> actual = (CDPStructuredFlowEvent<String>) underTest.convert(eventEntity); Assertions.assertEquals("accountId", operationDetails.getAccountId()); Assertions.assertEquals("payload", actual.getPayload()); }