You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A junit version 4 tests runner which provides the expected json file.
1
+
# java-maven3-junit4-runner
2
+
3
+
First, this runner compiles the project and generate all jars (project + dependencies).
4
+
5
+
At each play, it compiles user's answer using `javac` and run the specified testcase using junit4.
6
+
7
+
8
+
# How to Use
9
+
10
+
To use this runner for your project, edit the `codingame.yml` file and add the following lines to your project:
11
+
12
+
runner:
13
+
name: codingame/java-maven3-junit4-runner
14
+
version: 1.1.0-java-8
15
+
16
+
## Example
17
+
18
+
**A Git repository example**
19
+
20
+
```
21
+
.
22
+
├── about.md
23
+
├── codingame.yml
24
+
├── markdowns
25
+
│ └── <YOUR_LESSONS>.md
26
+
└── projects
27
+
└── example #Your project root
28
+
├── src/main/java
29
+
│ └── Example.java #The stub provided to the user
30
+
└── src/test/java
31
+
└── ExampleTest.java #Your JUnitTest Class
32
+
```
33
+
34
+
**In your CS project:**
35
+
36
+
*Example.java*
37
+
```java
38
+
publicclassExample
39
+
{
40
+
/**
41
+
* This method should return the sum between a and b
42
+
**/
43
+
publicvoidsum(inta, intb) {
44
+
return1;
45
+
}
46
+
}
47
+
```
48
+
49
+
*ExampleTestTest.java*
50
+
```java
51
+
import staticorg.junit.Assert.assertEquals;
52
+
publicclassExampleTest {
53
+
privateExample example;
54
+
@Before
55
+
publicvoidinit() {
56
+
example =newExample();
57
+
}
58
+
59
+
@Test
60
+
publicvoidtestSum(){
61
+
int a =23487;
62
+
int b =240587;
63
+
assertEquals(example.sum(a, b), a + b);
64
+
}
65
+
}
66
+
```
67
+
68
+
**In your lesson:**
69
+
```md
70
+
@[Fix the following code so that the function DoSum returns a sum of integer]({"stubs": ["src/main/java/Example.java"],"command": "ExampleTest#testSum"})
0 commit comments