Skip to content

Commit 6fdf2db

Browse files
authored
style: resolve some of the UTAO_JUNIT_ASSERTION_ODDITIES_USE_ASSERT_EQUALS warnings (#7240)
1 parent 0b0cefe commit 6fdf2db

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/test/java/com/thealgorithms/backtracking/CombinationTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ void testNoElement() {
2828
@Test
2929
void testLengthOne() {
3030
List<TreeSet<Integer>> result = Combination.combination(new Integer[] {1, 2}, 1);
31-
assertTrue(result.get(0).iterator().next() == 1);
32-
assertTrue(result.get(1).iterator().next() == 2);
31+
assertEquals(1, result.get(0).iterator().next());
32+
assertEquals(2, result.get(1).iterator().next());
3333
}
3434

3535
@Test
3636
void testLengthTwo() {
3737
List<TreeSet<Integer>> result = Combination.combination(new Integer[] {1, 2}, 2);
3838
Integer[] arr = result.get(0).toArray(new Integer[2]);
39-
assertTrue(arr[0] == 1);
40-
assertTrue(arr[1] == 2);
39+
assertEquals(1, arr[0]);
40+
assertEquals(2, arr[1]);
4141
}
4242

4343
@Test

src/test/java/com/thealgorithms/misc/ShuffleArrayTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.thealgorithms.misc;
22

33
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
4+
import static org.junit.jupiter.api.Assertions.assertEquals;
45
import static org.junit.jupiter.api.Assertions.assertNotEquals;
56
import static org.junit.jupiter.api.Assertions.assertTrue;
67

@@ -67,7 +68,7 @@ void testShuffleRetainsElements() {
6768
ShuffleArray.shuffle(arr);
6869

6970
// Check that the shuffled array contains the same elements
70-
assertTrue(arr.length == 5);
71+
assertEquals(5, arr.length);
7172
for (int i = 1; i <= 5; i++) {
7273
assertTrue(contains(arr, i));
7374
}

src/test/java/com/thealgorithms/others/PasswordGenTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public void failGenerationWithSameMinMaxLengthTest() {
1717
@Test
1818
public void generateOneCharacterPassword() {
1919
String tempPassword = PasswordGen.generatePassword(1, 2);
20-
assertTrue(tempPassword.length() == 1);
20+
assertEquals(1, tempPassword.length());
2121
}
2222

2323
@Test

0 commit comments

Comments
 (0)