Use foreach where possible

This commit is contained in:
Lars Grefer
2019-07-04 19:16:52 +02:00
committed by Josh Cummings
parent 7dc28ff376
commit 43737a56bd
7 changed files with 24 additions and 26 deletions

View File

@@ -122,10 +122,10 @@ public class BCryptTests {
@Test
public void testHashpw() {
print("BCrypt.hashpw(): ");
for (int i = 0; i < test_vectors.length; i++) {
String plain = test_vectors[i][0];
String salt = test_vectors[i][1];
String expected = test_vectors[i][2];
for (String[] test_vector : test_vectors) {
String plain = test_vector[0];
String salt = test_vector[1];
String expected = test_vector[2];
String hashed = BCrypt.hashpw(plain, salt);
assertThat(expected).isEqualTo(hashed);
print(".");
@@ -176,9 +176,9 @@ public class BCryptTests {
@Test
public void testCheckpw_success() {
print("BCrypt.checkpw w/ good passwords: ");
for (int i = 0; i < test_vectors.length; i++) {
String plain = test_vectors[i][0];
String expected = test_vectors[i][2];
for (String[] test_vector : test_vectors) {
String plain = test_vector[0];
String expected = test_vector[2];
assertThat(BCrypt.checkpw(plain, expected)).isTrue();
print(".");
}