TraceMongoCommandListener implements CommandListener { static String getSpanName(String commandName, @Nullable String collectionName) { if (collectionName == null) return commandName; return commandName + " " + collectionName; } TraceMongoCommandListener(MongoDBTracing mongoDBTracing);   TraceMongoCommandListener(ThreadLocalSpan threadLocalSpan); @Override void commandStarted(CommandStartedEvent event); @Override void commandSucceeded(CommandSucceededEvent event); @Override void commandFailed(CommandFailedEvent event);  }
@Test public void getSpanName_emptyCollectionName() { assertThat(getSpanName("foo", null)).isEqualTo("foo"); }
@Test public void getSpanName_presentCollectionName() { assertThat(getSpanName("foo", "bar")).isEqualTo("foo bar"); }