### Question:
MultinomialPDF implements ProbabilityDensityFunction<T> { @Override public String toString() { String str = ""; for(Map.Entry<T, Double> entry: probabilities.entrySet()) { str += entry.getValue() + "," + entry.getKey() + "\n"; } return str; } MultinomialPDF(Map<T, Double> probabilities); Set<T> getData(); double probability(T value); @Override String toString();  }### Answer:
@Test public void testToString() { Map<String, Double> objects = ImmutableMap.of("A", 0.1, "B", 0.3, "C", 0.5); MultinomialPDF<String> pdf = new MultinomialPDF<String>(objects); String string = pdf.toString(); Set<String> observed = Sets.newHashSet(string.split("\n")); Set<String> expected = Sets.newHashSet("0.1,A", "0.3,B", "0.5,C"); Assert.assertEquals(expected, observed); }