-
Notifications
You must be signed in to change notification settings - Fork 240
/
TextProcessorJDKTest.java
74 lines (62 loc) · 2.72 KB
/
TextProcessorJDKTest.java
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
73
74
/*
* Copyright (c) 2023 The Bank of New York Mellon.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompany this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*/
package org.eclipse.collections.haikukata;
import java.util.AbstractMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
public class TextProcessorJDKTest
{
// @Test // Uncomment once topLetters is implemented for JDK
// @Tag("SOLUTION")
public void topLetters()
{
List<Map.Entry<Character, Long>> top3 = new TextProcessorJDK().topLetters();
Assertions.assertEquals(new AbstractMap.SimpleEntry<>('e', 94L), top3.get(0));
Assertions.assertEquals(new AbstractMap.SimpleEntry<>('t', 65L), top3.get(1));
Assertions.assertEquals(new AbstractMap.SimpleEntry<>('i', 62L), top3.get(2));
}
// @Test // Uncomment once distinctLetters is implemented for JDK
// @Tag("SOLUTION")
public void distinctLetters()
{
String distinctLetters = new TextProcessorJDK().distinctLetters();
Assertions.assertEquals("breakingthoupvmwcdflsy", distinctLetters);
}
// @Test // Uncomment once duplicatesAndUnique is implemented for JDK
// @Tag("SOLUTION")
public void duplicatesAndUnique()
{
TextProcessorJDK.CharCountsDuplicatesUnique cdu = new TextProcessorJDK().duplicatesAndUnique();
Assertions.assertEquals(cdu.chars(), cdu.duplicates());
Assertions.assertEquals(Set.of(), cdu.unique());
}
// @Test // Uncomment once topVowelAndConsonant is implemented for JDK
// @Tag("SOLUTION")
public void topVowelAndConsonant()
{
TextProcessorJDK.TopVowelAndConsonant vowelAndConsonant = new TextProcessorJDK().topVowelAndConsonant();
Assertions.assertEquals('e', vowelAndConsonant.vowel());
Assertions.assertEquals('t', vowelAndConsonant.consonant());
}
// @Test // Uncomment once findWordleWords is implemented for JDK
// @Tag("SOLUTION")
public void findWordleWords()
{
Set<String> wordleWords = new TextProcessorJDK().findWordleWords();
Set<String> expected =
Set.of("haiku", "death", "wrote", "bacon", "shine", "house", "where", "thank", "break",
"which", "cocoa", "drink", "write", "slide", "found");
Assertions.assertEquals(expected, wordleWords);
}
}