This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FrequencyImpl implements Frequency { | |
@Override | |
public Map<Character, Double> analyze(String text) { | |
if (text == null) { | |
throw new IllegalArgumentException(); | |
} | |
text = text.toLowerCase(); | |
Map<Character, Double> characterFrequency = new HashMap<>(); | |
long distintChars = text.chars().distinct().count(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FrequencyTest { | |
private Frequency frequency; | |
@BeforeEach | |
void setUp() { | |
frequency = getFrequency(); | |
} | |
@Test |