@Override
    public void post(SpanAdapter span, Exchange exchange, Endpoint endpoint) {
        if (exchange.isFailed()) {
            span.setError(true);
            if (exchange.getException() != null) {
                Map<String, String> logEvent = new HashMap<>();
                logEvent.put("event", "error");
                logEvent.put("error.kind", "Exception");
                logEvent.put("message", exchange.getException().getMessage());
                span.log(logEvent);
            }
        }
    }
@Test
    public void testPostExchangeFailed() {
        Exchange exchange = Mockito.mock(Exchange.class);

        Mockito.when(exchange.isFailed()).thenReturn(true);

        Exception e = new Exception("Test Message");
        Mockito.when(exchange.getException()).thenReturn(e);

        SpanDecorator decorator = new AbstractSpanDecorator() {
            @Override
            public String getComponent() {
                return null;
            }

            @Override
            public String getComponentClassName() {
                return null;
            }
        };

        MockSpanAdapter span = new MockSpanAdapter();

        decorator.post(span, exchange, null);

        assertEquals(true, span.tags().get(TagConstants.ERROR));
        assertEquals(1, span.logEntries().size());
        assertEquals("error", span.logEntries().get(0).fields().get("event"));
        assertEquals("Exception", span.logEntries().get(0).fields().get("error.kind"));
        assertEquals(e.getMessage(), span.logEntries().get(0).fields().get("message"));
    }