### Question:
Template { public String evaluate() { TemplateParse p = new TemplateParse(); List<Segment> segments = p.parseSegments(templateText); return concatenate(segments); } Template(String templateText); void set(String name, String value); String evaluate();  }### Answer:
@Test public void missingValueRaisesException() { try { new Template("${foo}").evaluate(); fail("evaluate() should throw an exception if " + "a placeholder was left without a value!"); } catch (MissingValueException expected) { assertEquals("No value for ${foo}", expected.getMessage()); } }
@Test(expected = MissingValueException.class) public void missingValueRaisesException_withAnnotation() { new Template("${foo}").evaluate(); }