KafkaAuthenticationSpecificConfig implements KafkaSpecificConfig { @Override public boolean isApplicable(final Connection connection) { return connection.getUsername().isPresent() && connection.getPassword().isPresent(); } private  KafkaAuthenticationSpecificConfig(); static KafkaAuthenticationSpecificConfig getInstance(); @Override boolean isApplicable(final Connection connection); @Override void validateOrThrow(final Connection connection, final DittoHeaders dittoHeaders); @Override boolean isValid(final Connection connection); @Override void apply(final HashMap<String, Object> producerProperties, final Connection connection);  }
@Test public void shouldBeApplicableIfCredentialsExist() { final Connection defaultConnection = getConnection(KNOWN_USER, KNOWN_PASSWORD, defaultSpecificConfig); assertThat(underTest.isApplicable(defaultConnection)).isTrue(); }
@Test public void shouldNotBeApplicableIfCredentialsAreMissing() { final Connection connection = getConnectionWithoutUsernameAndPassword(); assertThat(underTest.isApplicable(connection)).isFalse(); }