Skip to content

Commit 2464471

Browse files
authored
Merge pull request mouredev#4916 from chartypes/my-contributions
#13-Java
2 parents de33b32 + 6d11d8f commit 2464471

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import static org.junit.Assert.assertEquals;
2+
import org.junit.Test;
3+
4+
public class chartypes {
5+
6+
public static void main(String[] args) {
7+
Tests.addSumCorrectly();
8+
}
9+
10+
// Exercise
11+
public static int add(int x, int y) {
12+
return x + y;
13+
}
14+
}
15+
16+
class Tests {
17+
@Test
18+
static void addSumCorrectly() {
19+
assertEquals(4, chartypes.add(2, 2));
20+
assertEquals(5, chartypes.add(3, 2));
21+
assertEquals(0, chartypes.add(0, 0));
22+
assertEquals(100, chartypes.add(99, 1));
23+
assertEquals(1, chartypes.add(0, 1));
24+
}
25+
}

0 commit comments

Comments
 (0)