Skip to content

Commit 610a7eb

Browse files
author
patched.codes[bot]
committed
Patched tests/cicd/generate_docstring/test_file.py
1 parent c953072 commit 610a7eb

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import static org.junit.jupiter.api.Assertions.assertEquals;
2+
import static org.junit.jupiter.api.Assertions.assertThrows;
3+
import java.util.function.Function;
4+
import org.junit.jupiter.api.Test;
5+
6+
class TestTest {
7+
8+
@Test
9+
void testA_plus_bIntegers() {
10+
assertEquals(5, Test.a_plus_b(2, 3));
11+
assertEquals(0, Test.a_plus_b(-2, 2));
12+
assertEquals(-5, Test.a_plus_b(-2, -3));
13+
}
14+
15+
@Test
16+
void testA_plus_bFunction() {
17+
Function<Object, Comparable> keymap = o -> (Integer) o;
18+
19+
assertEquals(-1, Test.a_plus_b(keymap, 2, 3));
20+
assertEquals(1, Test.a_plus_b(keymap, 3, 2));
21+
assertEquals(0, Test.a_plus_b(keymap, 2, 2));
22+
}
23+
24+
@Test
25+
void testA_plus_bInvalidInputs() {
26+
assertThrows(ClassCastException.class, () -> Test.a_plus_b(null, 3));
27+
assertThrows(NullPointerException.class, () -> Test.a_plus_b(o -> (Integer) o, null, 2));
28+
}
29+
}

0 commit comments

Comments
 (0)