### Question:
TextParser { public static Text parse(String text) { Validate.notNull(text, "Text is null"); return new Text(text); } private  TextParser(); static Text parse(String text);  }### Answer:
@Test public void testTextIsParsed() throws Exception { Text text = TextParser.parse(""); Assert.assertNotNull(text); Assert.assertEquals("", text.getText()); text = TextParser.parse("text"); Assert.assertNotNull(text); Assert.assertEquals("text", text.getText()); text = TextParser.parse(" text "); Assert.assertNotNull(text); Assert.assertEquals(" text ", text.getText()); }
@Test(expected=Exception.class) public void testParserFailsOnIllegalArgument() throws Exception { TextParser.parse(null); }