@Override
    public void pre(SpanAdapter span, Exchange exchange, Endpoint endpoint) {
        super.pre(span, exchange, endpoint);

        span.setTag(TagConstants.DB_SYSTEM, getComponent());
        Map<String, String> queryParameters = toQueryParameters(endpoint.getEndpointUri());
        String database = queryParameters.get("database");
        if (database != null) {
            span.setTag(TagConstants.DB_NAME, database);
        }
        span.setTag(TagConstants.DB_STATEMENT, queryParameters.toString());
    }
@Test
    public void testPre() {
        Endpoint endpoint = Mockito.mock(Endpoint.class);

        Mockito.when(endpoint.getEndpointUri()).thenReturn(MONGODB_STATEMENT);

        SpanDecorator decorator = new MongoDBSpanDecorator();

        MockSpanAdapter span = new MockSpanAdapter();

        decorator.pre(span, null, endpoint);

        assertEquals("mongodb", span.tags().get(TagConstants.DB_SYSTEM));
        assertEquals("flights", span.tags().get(TagConstants.DB_NAME));
        assertTrue(span.tags().containsKey(TagConstants.DB_STATEMENT));
    }