Frequency { @Override public String toString() { return "Frequency{" + source + "=" + value + '}'; } private  Frequency(FrequencySource source, float value); static Frequency of(FrequencySource source, float value); float getFrequency(); FrequencySource getSource(); boolean isOverThreshold(float threshold); @Override int hashCode(); @Override boolean equals(Object o); @Override String toString();  }
@Test public void testToString() { float frequency = 1.0f; Frequency instance = Frequency.of(UNKNOWN, frequency); assertThat(instance.toString(), equalTo(String.format(Locale.UK, "Frequency{UNKNOWN=%s}", frequency))); }