forked from codewars/codewars-runner-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjava.yml
More file actions
42 lines (34 loc) · 1.15 KB
/
Copy pathjava.yml
File metadata and controls
42 lines (34 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
junit:
reference:
initial: |-
public class Person {
String name;
public Person(String personName) {
// TODO: Program Constructor
}
public String greet(String yourName) {
// TODO: Write a greeting string
}
}
answer: |-
public class Person {
String name;
public Person(String personName) {
name = personName;
}
public String greet(String yourName) {
return String.format("Konbanwa! My name is %s. It is nice to meet you, %s!", this.name, yourName);
}
}
fixture: |-
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import org.junit.runners.JUnit4;
public class PersonTest {
@Test
public void testGreet() {
Person shoki = new Person("Shoki, the Demon Queller");
assertEquals("Konbanwa! My name is Shoki, the Demon Queller. It is nice to meet you, Sun Wukong, the Monkey King!",
shoki.greet("Sun Wukong, the Monkey King"));
}
}