KafkaAuthenticationSpecificConfig implements KafkaSpecificConfig { @Override public boolean isValid(final Connection connection) { return containsValidSaslMechanismConfiguration(connection); } 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 shouldBeValidIfContainsNoSaslMechanism() { assertThat(underTest.isValid(getConnectionWithSaslMechanism(null))).isTrue(); }
@Test public void shouldBeValidIfContainsSupportedSaslMechanism() { assertThat(underTest.isValid(getConnectionWithSaslMechanism(KNOWN_PLAIN_SASL_MECHANISM))).isTrue(); assertThat(underTest.isValid(getConnectionWithSaslMechanism(KNOWN_SHA256_SASL_MECHANISM))).isTrue(); assertThat(underTest.isValid(getConnectionWithSaslMechanism(KNOWN_SHA512_SASL_MECHANISM))).isTrue(); }
@Test public void shouldBeInvalidIfContainsUnsupportedSaslMechanism() { assertThat(underTest.isValid( getConnectionWithSaslMechanism(KNOWN_UNSUPPORTED_OAUTHBEARER_SASL_MECHANISM))).isFalse(); assertThat( underTest.isValid(getConnectionWithSaslMechanism(KNOWN_UNSUPPORTED_GSSAPI_SASL_MECHANISM))).isFalse(); assertThat(underTest.isValid(getConnectionWithSaslMechanism(UNKNOWN_SASL_MECHANISM))).isFalse(); }