mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-12-19 07:00:35 +08:00
refactor: TwoPointers (#6374)
* refactor: TwoPointers * refactor: fix test formatting * refactor: fix checkstyle * refactor: fix checkstyle
This commit is contained in:
committed by
GitHub
parent
182118b6a4
commit
ef93cc1503
@@ -1,6 +1,8 @@
|
||||
package com.thealgorithms.others;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -69,4 +71,10 @@ public class TwoPointersTest {
|
||||
int key = 9;
|
||||
assertTrue(TwoPointers.isPairedSum(arr, key));
|
||||
}
|
||||
|
||||
@Test
|
||||
void isPairedSumShouldThrowExceptionWhenArrayIsNull() {
|
||||
IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> TwoPointers.isPairedSum(null, 10));
|
||||
assertEquals("Input array must not be null.", exception.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user