@@ -0,0 +1,2288 @@
+package net.ttddyy.dsproxy.listener;%0A%0Aimport net.ttddyy.dsproxy.ConnectionInfo;%0Aimport org.junit.Test;%0A%0Aimport java.lang.reflect.Method;%0Aimport java.sql.PreparedStatement;%0Aimport java.util.concurrent.atomic.AtomicBoolean;%0Aimport java.util.concurrent.atomic.AtomicReference;%0A%0Aimport static org.assertj.core.api.Assertions.assertThat;%0A%0A/**%0A * @author Tadaya Tsuyukubo%0A */%0Apublic class TracingMethodListenerTest %7B%0A%0A    @Test%0A    public void tracingCondition() %7B%0A%0A        TracingMethodListener.TracingCondition falseCondition = new TracingMethodListener.TracingCondition() %7B%0A            @Override%0A            public boolean getAsBoolean() %7B%0A                return false;%0A            %7D%0A        %7D;%0A%0A        final AtomicBoolean isCalled = new AtomicBoolean(false);%0A        TracingMethodListener listener = new TracingMethodListener() %7B%0A            @Override%0A            protected void logMessage(String message) %7B%0A                isCalled.set(true);%0A            %7D%0A        %7D;%0A        listener.setTracingCondition(falseCondition);%0A%0A        // invoke%0A        listener.afterMethod(MethodExecutionContext.Builder.create().build());%0A%0A        assertThat(isCalled.get()).isFalse();%0A    %7D%0A%0A    @Test%0A    public void logMessage() throws Exception %7B%0A        final AtomicReference%3CString%3E messageHolder = new AtomicReference%3CString%3E();%0A        TracingMethodListener listener = new TracingMethodListener() %7B%0A            @Override%0A            protected void logMessage(String message) %7B%0A                messageHolder.set(message);%0A            %7D%0A        %7D;%0A%0A        class MyTarget %7B%0A        %7D%0A%0A        MyTarget target = new MyTarget();%0A%0A        Method method = PreparedStatement.class.getMethod(%22setString%22, int.class, String.class);%0A        ConnectionInfo connectionInfo = new ConnectionInfo();%0A        connectionInfo.setConnectionId(100);%0A%0A        MethodExecutionContext context = MethodExecutionContext.Builder.create()%0A                .target(target)%0A                .method(method)%0A                .elapsedTime(99)%0A                .connectionInfo(connectionInfo)%0A                .methodArgs(new Object%5B%5D%7B50, %22foo%22%7D)%0A                .build();%0A%0A        listener.afterMethod(context);%0A%0A        assertThat(messageHolder.get()).isEqualTo(%22%5B1%5D%5Bsuccess%5D%5B99ms%5D%5Bconn=100%5D MyTarget#setString(50,%5C%22foo%5C%22)%22);%0A    %7D%0A%7D%0A

Add TracingMethodListenerTest