### Question:
StructuredEventFilterUtil { public void sendStructuredEvent(RestRequestDetails restRequest, RestResponseDetails restResponse, Map<String, String> restParams, Long requestTime, String responseBody) { boolean valid = checkRestParams(restParams); try { if (!valid) { LOGGER.debug("Cannot create structured event, because rest params are invalid."); return; } restResponse.setBody(responseBody); RestCallDetails restCall = new RestCallDetails(); restCall.setRestRequest(restRequest); restCall.setRestResponse(restResponse); restCall.setDuration(System.currentTimeMillis() - requestTime); Map<String, String> params = restCommonService.collectCrnAndNameIfPresent(restCall, null, restParams, RESOURCE_NAME, RESOURCE_CRN); dataCollector.fetchDataFromDbIfNeed(params); restParams.putAll(params); CDPOperationDetails cdpOperationDetails = restEventFilterRelatedObjectFactory.createCDPOperationDetails(restParams, requestTime); CDPStructuredRestCallEvent structuredEvent = new CDPStructuredRestCallEvent(cdpOperationDetails, restCall, null, null); structuredEventClient.sendStructuredEvent(structuredEvent); } catch (Exception ex) { LOGGER.warn("Failed to send structured event: " + ex.getMessage(), ex); } }  InputStream logInboundEntity(StringBuilder content, InputStream stream, Charset charset); void sendStructuredEvent(RestRequestDetails restRequest, RestResponseDetails restResponse, Map<String, String> restParams, Long requestTime,
            String responseBody);  }### Answer:
@Test public void testSendStructuredEventWhenRestParamIsEmptyMapThenParamsAreInvalid() { RestRequestDetails restRequestDetails = new RestRequestDetails(); RestResponseDetails restResponseDetails = new RestResponseDetails(); underTest.sendStructuredEvent(restRequestDetails, restResponseDetails, Collections.emptyMap(), 0L, null); verify(structuredEventClient, never()).sendStructuredEvent(any()); }
@Test public void testSendStructuredEventWhenRestParamIsNotEmptyMapButValuesAreNullThenParamsAreInvalid() { RestRequestDetails restRequestDetails = new RestRequestDetails(); RestResponseDetails restResponseDetails = new RestResponseDetails(); Map<String, String> restParams = new HashMap<>(); restParams.put("key", null); underTest.sendStructuredEvent(restRequestDetails, restResponseDetails, restParams, 0L, null); verify(structuredEventClient, never()).sendStructuredEvent(any()); }
@Test public void testSendStructuredEventWhenRestParamsAreOkThenParamsAreValid() { RestRequestDetails restRequestDetails = new RestRequestDetails(); RestResponseDetails restResponseDetails = new RestResponseDetails(); Map<String, String> restParams = new HashMap<>(); restParams.put("key", "val"); underTest.sendStructuredEvent(restRequestDetails, restResponseDetails, restParams, 0L, null); verify(structuredEventClient).sendStructuredEvent(any()); }