### Question:
HostAwareGraphiteReporterFactory extends GraphiteReporterFactory { @Override public void setPrefix(String prefix) { String regex = HOSTNAME_REGEX; if (prefix.matches(regex)) { throw new IllegalArgumentException("The prefix can not contain a `%` without a trailing `s`."); } super.setPrefix(prefix); } HostAwareGraphiteReporterFactory(); @Override void setPrefix(String prefix); @Override String getPrefix();  }### Answer:
@Test(expected = IllegalArgumentException.class) public void handles_poorly_formated_prefixes() throws UnknownHostException { HostAwareGraphiteReporterFactory reporterFactory = buildReporter("hostName"); reporterFactory.setPrefix("before.%s.aft%er..last"); }