-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathAcronymTest.java
More file actions
72 lines (59 loc) · 1.78 KB
/
AcronymTest.java
File metadata and controls
72 lines (59 loc) · 1.78 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
72
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class AcronymTest {
@Test
public void basic() {
String phrase = "Portable Network Graphics";
String expected = "PNG";
assertEquals(expected, new Acronym(phrase).get());
}
@Test
public void lowercaseWords() {
String phrase = "Ruby on Rails";
String expected = "ROR";
assertEquals(expected, new Acronym(phrase).get());
}
@Test
public void punctuation() {
String phrase = "First In, First Out";
String expected = "FIFO";
assertEquals(expected, new Acronym(phrase).get());
}
@Test
public void nonAcronymAllCapsWord() {
String phrase = "GNU Image Manipulation Program";
String expected = "GIMP";
assertEquals(expected, new Acronym(phrase).get());
}
@Test
public void punctuationWithoutWhitespace() {
String phrase = "Complementary metal-oxide semiconductor";
String expected = "CMOS";
assertEquals(expected, new Acronym(phrase).get());
}
@Test
public void veryLongAbbreviation() {
String phrase = "Rolling On The Floor Laughing So Hard That My Dogs Came Over And Licked Me";
String expected = "ROTFLSHTMDCOALM";
assertEquals(expected, new Acronym(phrase).get());
}
@Test
public void consecutiveDelimiters() {
String phrase = "Something - I made up from thin air";
String expected = "SIMUFTA";
assertEquals(expected, new Acronym(phrase).get());
}
@Test
public void apostrophes() {
String phrase = "Halley's Comet";
String expected = "HC";
assertEquals(expected, new Acronym(phrase).get());
}
@Test
public void underscoreEmphasis() {
String phrase = "The Road _Not_ Taken";
String expected = "TRNT";
assertEquals(expected, new Acronym(phrase).get());
}
}