Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion word-count/src/example/java/WordCount.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

public class WordCount {

public Map<String, Integer> Phrase( String input ) {
public Map<String, Integer> phrase( String input ) {
Map<String, Integer> countMap = new HashMap<String, Integer>();
input = input.trim().toLowerCase().replaceAll("[\\W]", " ");
final String[] tokenizedInput = input.split("\\s+");
Expand Down
12 changes: 6 additions & 6 deletions word-count/src/test/java/WordCountTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public void countOneWord() {
final Map<String, Integer> expectedWordCount = new HashMap<String, Integer>();
expectedWordCount.put("word", 1);

actualWordCount = wordCount.Phrase("word");
actualWordCount = wordCount.phrase("word");
assertEquals(
expectedWordCount, actualWordCount
);
Expand All @@ -31,7 +31,7 @@ public void countOneOfEach() {
expectedWordCount.put("of", 1);
expectedWordCount.put("each", 1);

actualWordCount = wordCount.Phrase("one of each");
actualWordCount = wordCount.phrase("one of each");
assertEquals(
expectedWordCount, actualWordCount
);
Expand All @@ -47,7 +47,7 @@ public void countMultipleOccurences() {
expectedWordCount.put("red", 1);
expectedWordCount.put("blue", 1);

actualWordCount = wordCount.Phrase("one fish two fish red fish blue fish");
actualWordCount = wordCount.phrase("one fish two fish red fish blue fish");
assertEquals(
expectedWordCount, actualWordCount
);
Expand All @@ -63,7 +63,7 @@ public void ignorePunctuation() {
expectedWordCount.put("java", 1);
expectedWordCount.put("javascript", 1);

actualWordCount = wordCount.Phrase("car : carpet as java : javascript!!&@$%^&");
actualWordCount = wordCount.phrase("car : carpet as java : javascript!!&@$%^&");
assertEquals(
expectedWordCount, actualWordCount
);
Expand All @@ -78,7 +78,7 @@ public void includeNumbers() {
expectedWordCount.put("1", 1);
expectedWordCount.put("2", 1);

actualWordCount = wordCount.Phrase("testing, 1, 2 testing");
actualWordCount = wordCount.phrase("testing, 1, 2 testing");
assertEquals(
expectedWordCount, actualWordCount
);
Expand All @@ -90,7 +90,7 @@ public void normalizeCase() {
final Map<String, Integer> expectedWordCount = new HashMap<String, Integer>();
expectedWordCount.put("go", 3);

actualWordCount = wordCount.Phrase("go Go GO");
actualWordCount = wordCount.phrase("go Go GO");
assertEquals(
expectedWordCount, actualWordCount
);
Expand Down