File tree Expand file tree Collapse file tree 4 files changed +9
-12
lines changed
src/test/java/com/thealgorithms Expand file tree Collapse file tree 4 files changed +9
-12
lines changed Original file line number Diff line number Diff line change 222222 <Match >
223223 <Bug pattern =" UTAO_JUNIT_ASSERTION_ODDITIES_USE_ASSERT_NOT_NULL" />
224224 </Match >
225- <Match >
226- <Bug pattern =" UTAO_JUNIT_ASSERTION_ODDITIES_USE_ASSERT_NULL" />
227- </Match >
228225 <Match >
229226 <Bug pattern =" UTAO_JUNIT_ASSERTION_ODDITIES_IMPOSSIBLE_NULL" />
230227 </Match >
Original file line number Diff line number Diff line change 11package com .thealgorithms .ciphers ;
22
33import static org .junit .jupiter .api .Assertions .assertEquals ;
4+ import static org .junit .jupiter .api .Assertions .assertNull ;
45import static org .junit .jupiter .api .Assertions .assertThrows ;
56
67import org .junit .jupiter .api .Test ;
@@ -121,8 +122,8 @@ void testNullString() {
121122 String decrypted = cipher .decrypt (encrypted , key );
122123
123124 // then
124- assertEquals ( null , encrypted );
125- assertEquals ( null , decrypted );
125+ assertNull ( encrypted );
126+ assertNull ( decrypted );
126127 }
127128
128129 @ Test
Original file line number Diff line number Diff line change 22
33import static org .junit .jupiter .api .Assertions .assertEquals ;
44import static org .junit .jupiter .api .Assertions .assertFalse ;
5+ import static org .junit .jupiter .api .Assertions .assertNull ;
56
67import org .junit .jupiter .api .Test ;
78
@@ -30,7 +31,7 @@ public void searchAndNotFound() {
3031 treap .insert (3 );
3132 treap .insert (8 );
3233 treap .insert (1 );
33- assertEquals ( null , treap .search (4 ));
34+ assertNull ( treap .search (4 ));
3435 }
3536
3637 @ Test
Original file line number Diff line number Diff line change 11package com .thealgorithms .dynamicprogramming ;
22
33import static org .junit .jupiter .api .Assertions .assertEquals ;
4+ import static org .junit .jupiter .api .Assertions .assertNull ;
45
56import org .junit .jupiter .api .Test ;
67
@@ -55,27 +56,24 @@ public void testLCSWithBothEmptyStrings() {
5556 public void testLCSWithNullFirstString () {
5657 String str1 = null ;
5758 String str2 = "XYZ" ;
58- String expected = null ; // Should return null if first string is null
5959 String result = LongestCommonSubsequence .getLCS (str1 , str2 );
60- assertEquals ( expected , result );
60+ assertNull ( result );
6161 }
6262
6363 @ Test
6464 public void testLCSWithNullSecondString () {
6565 String str1 = "ABC" ;
6666 String str2 = null ;
67- String expected = null ; // Should return null if second string is null
6867 String result = LongestCommonSubsequence .getLCS (str1 , str2 );
69- assertEquals ( expected , result );
68+ assertNull ( result );
7069 }
7170
7271 @ Test
7372 public void testLCSWithNullBothStrings () {
7473 String str1 = null ;
7574 String str2 = null ;
76- String expected = null ; // Should return null if both strings are null
7775 String result = LongestCommonSubsequence .getLCS (str1 , str2 );
78- assertEquals ( expected , result );
76+ assertNull ( result );
7977 }
8078
8179 @ Test
You can’t perform that action at this time.
0 commit comments