### Question:
ConfiguratorMain { protected static String cleanLine(String input) { if (input == null) { return null; } String ret = input.trim(); if (input.contains("#")) { ret = Pattern.compile("\\s*?#.*$").matcher(ret).replaceAll(""); } return ret.length() > 0 ? ret : null; }  static void main(String[] args);  }### Answer:
@Test public void testCleanLine() { String testout = null; testout = ConfiguratorMain.cleanLine(""); Assert.assertNull(testout); testout = ConfiguratorMain.cleanLine("# "); Assert.assertNull(testout); testout = ConfiguratorMain.cleanLine(" # "); Assert.assertNull(testout); testout = ConfiguratorMain.cleanLine(" xxx"); Assert.assertEquals(testout, "xxx"); testout = ConfiguratorMain.cleanLine("xxx # blah"); Assert.assertEquals(testout, "xxx"); testout = ConfiguratorMain.cleanLine("xxx#blah"); Assert.assertEquals(testout, "xxx"); }