@Test
public void testDetectorCreateMappings() {

    List<DetectorMapping> detectorMappings = mockDetectorMappingsList();
    CreateDetectorMappingRequest createDetectorMappingRequest = new CreateDetectorMappingRequest();
    List<Operand> operandsList = new ArrayList<Operand>();
    Operand testOperand = new Operand();
    testOperand.setField(new Field("name", "sample-web"));
    operandsList.add(testOperand);
    Expression validateExpression = new Expression();
    validateExpression.setOperands(operandsList);
    validateExpression.setOperator(Operator.AND);
    createDetectorMappingRequest.setExpression(validateExpression);
    createDetectorMappingRequest.setConsumerDetectorMapping(buildDetector(UUID.randomUUID().toString()));
    createDetectorMappingRequest.setUser(new User(userVal));
    String detectorMapping = mockDetectorMapping(id).toString();
    val testDetectorMappingSpanContext = new SpanContext(UUID.randomUUID(), UUID.randomUUID(),
            UUID.randomUUID());
    val testChildSpan = noOpsTracer.buildSpan("create-mappings").asChildOf(testDetectorMappingSpanContext).start();
    when(detectorMappingRepo.createDetectorMapping(createDetectorMappingRequest)).thenReturn(detectorMapping);
    when(trace.extractParentSpan(httpHeaders)).thenReturn(testDetectorMappingSpanContext);
    when(trace.startSpan("create-mappings", testDetectorMappingSpanContext)).thenReturn(testChildSpan);
    String detectorMappingsResponse = controllerUnderTest.createDetectorMapping(createDetectorMappingRequest,
            httpHeaders);
    assertEquals(detectorMapping.toString(), detectorMappingsResponse);
}