-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProverbTest.java
More file actions
71 lines (56 loc) · 2.23 KB
/
ProverbTest.java
File metadata and controls
71 lines (56 loc) · 2.23 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Ignore;
import org.junit.Test;
public class ProverbTest {
@Test
public void zeroWordsAreGiven() {
String[] words = new String[0];
assertThat(new Proverb(words).recite()).isEqualTo("");
}
@Test
public void singlePieceOfProverb() {
String[] words = new String[]{"nail"};
assertThat(new Proverb(words).recite())
.isEqualTo("And all for the want of a nail.");
}
@Test
public void twoPiecesOfProverb() {
String[] words = new String[]{"nail", "shoe"};
assertThat(new Proverb(words).recite())
.isEqualTo(
"For want of a nail the shoe was lost.\n" +
"And all for the want of a nail.");
}
@Test
public void shortChainOfConsequences() {
String[] words = new String[]{"nail", "shoe", "horse"};
assertThat(new Proverb(words).recite())
.isEqualTo(
"For want of a nail the shoe was lost.\n" +
"For want of a shoe the horse was lost.\n" +
"And all for the want of a nail.");
}
@Test
public void fullProverb() {
String[] words = new String[]{"nail", "shoe", "horse", "rider", "message", "battle", "kingdom"};
assertThat(new Proverb(words).recite())
.isEqualTo(
"For want of a nail the shoe was lost.\n" +
"For want of a shoe the horse was lost.\n" +
"For want of a horse the rider was lost.\n" +
"For want of a rider the message was lost.\n" +
"For want of a message the battle was lost.\n" +
"For want of a battle the kingdom was lost.\n" +
"And all for the want of a nail.");
}
@Test
public void fourPiecesModernizedProverb() {
String[] words = new String[]{"pin", "gun", "soldier", "battle"};
assertThat(new Proverb(words).recite())
.isEqualTo(
"For want of a pin the gun was lost.\n" +
"For want of a gun the soldier was lost.\n" +
"For want of a soldier the battle was lost.\n" +
"And all for the want of a pin.");
}
}