style: include UTAO_JUNIT_ASSERTION_ODDITIES_USE_ASSERT_NULL (#7225)

This commit is contained in:
Piotr Idzik
2026-01-20 22:02:10 +01:00
committed by GitHub
parent ba5ccbe0c7
commit 1b014a2ea4
4 changed files with 9 additions and 12 deletions

View File

@@ -222,9 +222,6 @@
<Match>
<Bug pattern="UTAO_JUNIT_ASSERTION_ODDITIES_USE_ASSERT_NOT_NULL" />
</Match>
<Match>
<Bug pattern="UTAO_JUNIT_ASSERTION_ODDITIES_USE_ASSERT_NULL" />
</Match>
<Match>
<Bug pattern="UTAO_JUNIT_ASSERTION_ODDITIES_IMPOSSIBLE_NULL" />
</Match>

View File

@@ -1,6 +1,7 @@
package com.thealgorithms.ciphers;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import org.junit.jupiter.api.Test;
@@ -121,8 +122,8 @@ class PermutationCipherTest {
String decrypted = cipher.decrypt(encrypted, key);
// then
assertEquals(null, encrypted);
assertEquals(null, decrypted);
assertNull(encrypted);
assertNull(decrypted);
}
@Test

View File

@@ -2,6 +2,7 @@ package com.thealgorithms.datastructures.trees;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
import org.junit.jupiter.api.Test;
@@ -30,7 +31,7 @@ public class TreapTest {
treap.insert(3);
treap.insert(8);
treap.insert(1);
assertEquals(null, treap.search(4));
assertNull(treap.search(4));
}
@Test

View File

@@ -1,6 +1,7 @@
package com.thealgorithms.dynamicprogramming;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import org.junit.jupiter.api.Test;
@@ -55,27 +56,24 @@ public class LongestCommonSubsequenceTest {
public void testLCSWithNullFirstString() {
String str1 = null;
String str2 = "XYZ";
String expected = null; // Should return null if first string is null
String result = LongestCommonSubsequence.getLCS(str1, str2);
assertEquals(expected, result);
assertNull(result);
}
@Test
public void testLCSWithNullSecondString() {
String str1 = "ABC";
String str2 = null;
String expected = null; // Should return null if second string is null
String result = LongestCommonSubsequence.getLCS(str1, str2);
assertEquals(expected, result);
assertNull(result);
}
@Test
public void testLCSWithNullBothStrings() {
String str1 = null;
String str2 = null;
String expected = null; // Should return null if both strings are null
String result = LongestCommonSubsequence.getLCS(str1, str2);
assertEquals(expected, result);
assertNull(result);
}
@Test