MicrometerDuplexConnectionInterceptor implements DuplexConnectionInterceptor { @Override public MicrometerDuplexConnection apply(Type connectionType, DuplexConnection delegate) { Objects.requireNonNull(connectionType, "connectionType must not be null"); Objects.requireNonNull(delegate, "delegate must not be null"); return new MicrometerDuplexConnection(connectionType, delegate, meterRegistry, tags); } MicrometerDuplexConnectionInterceptor(MeterRegistry meterRegistry, Tag... tags); @Override MicrometerDuplexConnection apply(Type connectionType, DuplexConnection delegate);  }
@DisplayName("creates MicrometerDuplexConnection") @Test void apply() { assertThat(new MicrometerDuplexConnectionInterceptor(meterRegistry).apply(CLIENT, delegate)) .isInstanceOf(MicrometerDuplexConnection.class); }
@DisplayName("apply throws NullPointerException with null connectionType") @Test void applyNullConnectionType() { assertThatNullPointerException() .isThrownBy( () -> new MicrometerDuplexConnectionInterceptor(meterRegistry).apply(null, delegate)) .withMessage("connectionType must not be null"); }
@DisplayName("apply throws NullPointerException with null delegate") @Test void applyNullDelegate() { assertThatNullPointerException() .isThrownBy( () -> new MicrometerDuplexConnectionInterceptor(meterRegistry).apply(CLIENT, null)) .withMessage("delegate must not be null"); }