### Question:
TemplateVars { String toText() { Map<String, Object> vars = toVars(); return parsedTemplate().evaluate(vars); } TemplateVars();   }### Answer:
@Test public void testHappy() { HappyVars happy = new HappyVars(); happy.integer = 23; happy.string = "wibble"; happy.list = ImmutableList.of(5, 17, 23); assertThat(HappyVars.IGNORED_STATIC_FINAL).isEqualTo("hatstand"); String expectedText = "integer=23 string=wibble list=[5, 17, 23]"; String actualText = happy.toText(); assertThat(actualText).isEqualTo(expectedText); }
@Test public void testUnset() { HappyVars sad = new HappyVars(); sad.integer = 23; sad.list = ImmutableList.of(23); try { sad.toText(); fail("Did not get expected exception"); } catch (IllegalArgumentException expected) { } }
@Test public void testSubSub() { SubHappyVars vars = new SubHappyVars(); vars.integer = 23; vars.string = "wibble"; vars.list = ImmutableList.of(5, 17, 23); vars.character = 'ß'; String expectedText = "integer=23 string=wibble list=[5, 17, 23] character=ß"; String actualText = vars.toText(); assertThat(actualText).isEqualTo(expectedText); }