Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use assertArrayEquals and add proper error messages to asserts #864

Open
wants to merge 5 commits into
base: next
Choose a base branch
from

Conversation

ArneBab
Copy link
Contributor

@ArneBab ArneBab commented Sep 10, 2023

No description provided.

@ArneBab
Copy link
Contributor Author

ArneBab commented Jan 30, 2024

@bertm Inlined the method.

@Bombe imported Matchers.not statically.

@Bombe
Copy link
Contributor

Bombe commented Jan 31, 2024

@Bombe imported Matchers.not statically.

Much nicer, isn’t it? 😁

@@ -160,10 +164,10 @@ public void testSuccessfulRoundTripInPlace() throws GeneralSecurityException {
byte[] buffer = Hex.decode(plainText[i]);
byte[] plaintextCopy = buffer.clone();
crypt.encrypt(buffer, 0, buffer.length);
assertTrue(!Arrays.equals(buffer, plaintextCopy));
assertThat((Object) buffer, not(equalTo(plaintextCopy)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That cast is not necessary.

assertNotEquals(ciphertext1, ciphertext2);
assertNotEquals(ciphertext1, ciphertext3);
assertNotEquals(ciphertext2, ciphertext3);
assertThat((Object) ciphertext1, not(equalTo(ciphertext2)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And neither are these casts. 🙂

plaintext.position(header);
ciphertext.position(header);
assertTrue(!Arrays.equals(ciphertextBuf, copyCiphertextBuf));
assertThat((Object) ciphertextBuf, not(equalTo(copyCiphertextBuf)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More unnecessary casting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants