Fix Sonar issues

This commit is contained in:
Gary Russell
2019-11-08 09:28:35 -05:00
parent b5dfbe9e4c
commit 1cd3ebfa3a
2 changed files with 13 additions and 6 deletions

View File

@@ -102,8 +102,12 @@ public final class KafkaConditions {
@Override
public boolean matches(ConsumerRecord<K, ?> value) {
return value != null && ((value.key() == null && this.key == null)
|| (value.key() != null && value.key().equals(this.key)));
if (value == null) {
return false;
}
return value.key() == null
? this.key == null
: value.key().equals(this.key);
}
}
@@ -119,9 +123,12 @@ public final class KafkaConditions {
@Override
public boolean matches(ConsumerRecord<?, V> value) {
return value != null
&& (value.value() == null && this.payload == null
|| (value.value() != null && value.value().equals(this.payload)));
if (value == null) {
return false;
}
return value.value() == null
? this.payload == null
: value.value().equals(this.payload);
}
}

View File

@@ -165,7 +165,7 @@ public final class KafkaTestUtils {
});
reset.forEach((tp, off) -> consumer.seek(tp, off));
try {
Thread.sleep(50);
Thread.sleep(50); // NOSONAR magic#
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();