DATAREDIS-1212 - Polishing.

Remove overly pessimistic null checks. Use constant when channel/body are empty to avoid allocations. Remove superfluous final keywords.

Original pull request: #559.
This commit is contained in:
Mark Paluch
2020-10-16 13:46:21 +02:00
parent 588bf0a7ea
commit 7f9de716c8
7 changed files with 15 additions and 26 deletions

View File

@@ -31,7 +31,6 @@ public class BinaryKeyspaceIdentifierUnitTests {
@Test // DATAREDIS-744
public void shouldReturnIfKeyIsValid() {
assertThat(BinaryKeyspaceIdentifier.isValid(null)).isFalse();
assertThat(BinaryKeyspaceIdentifier.isValid("foo".getBytes())).isFalse();
assertThat(BinaryKeyspaceIdentifier.isValid("".getBytes())).isFalse();
assertThat(BinaryKeyspaceIdentifier.isValid("foo:bar".getBytes())).isTrue();

View File

@@ -64,14 +64,6 @@ public class KeyExpirationEventMessageListenerUnitTests {
assertThat((byte[]) captor.getValue().getSource()).isEqualTo(MESSAGE_BODY.getBytes());
}
@Test // DATAREDIS-425
public void handleMessageShouldNotRespondToNullMessage() {
listener.onMessage(null, "*".getBytes());
verifyZeroInteractions(publisherMock);
}
@Test // DATAREDIS-425, DATAREDIS-692
public void handleMessageShouldNotRespondToEmptyMessage() {