@Test
public void connect_url_scrubbed() throws Exception {

  when(mockRealDriver.connect(any(String.class), any(Properties.class)))
      .thenReturn(mockRealConnection);
  Properties properties = new Properties();
  TraceOptions traceOptions =
      TraceOptions.builder()
          .setEnabled(true)
          .setSqlScrubber(Scrubbers.KEEP)
          .setUrlScrubber(
              new Scrubbers.Scrubber() {
                @Override
                public Optional<String> apply(String input) {
                  return Optional.of("#scrubbed URL#");
                }
              })
          .build();
  Connection conn =
      driver.connect(
          "jdbc:stackdriver:mockdriver?user=root&password=123456", properties, traceOptions);
  conn.close();
  assertThat(conn).isNotNull();
  InOrder inOrder = inOrder(mockTraceService, mockTraceSpan, mockRealDriver, mockRealConnection);
  inOrder.verify(mockTraceService).open("JDBC.Driver#connect");
  inOrder.verify(mockTraceSpan).annotate(Label.DATABASE_URL, Optional.of("#scrubbed URL#"));
  inOrder.verify(mockRealDriver).connect("jdbc:mockdriver?user=root&password=123456", properties);
  inOrder.verify(mockTraceSpan).close();
  inOrder.verify(mockRealConnection).close();
  verifyNoMoreInteractions(mockTraceService, mockTraceSpan, mockRealDriver, mockRealConnection);
}