@Test public void testSuperTemplate() throws Exception { final StringTemplate3StatementLocator locator = StringTemplate3StatementLocator.builder(Kombucha.class) .withSuperGroup(SuperDrink.class) .withErrorListener(StringTemplateGroup.DEFAULT_ERROR_LISTENER) .allowImplicitTemplateGroup() .treatLiteralsAsTemplates() .shouldCache() .build(); // Test statement locator from child template group and verify templates table_name got correctly evaluated final StatementContext ctx = new TestingStatementContext(new HashMap<String, Object>()); final String getIngredients = locator.locate("getIngredients", ctx); Assert.assertEquals("select tea\n" + ", mushroom\n" + ", sugar from kombucha;", getIngredients); // Test statement locator from base template group final String awesomeness = locator.locate("awesomeness", ctx); Assert.assertEquals("awesomeness;", awesomeness); }
@Test public void testSuperTemplate() throws Exception { final StringTemplate3StatementLocator locator = StringTemplate3StatementLocator.builder(Kombucha.class) .withSuperGroup(SuperDrink.class) .withErrorListener(StringTemplateGroup.DEFAULT_ERROR_LISTENER) .allowImplicitTemplateGroup() .treatLiteralsAsTemplates() .shouldCache() .build(); // Test statement locator from child template group and verify templates table_name got correctly evaluated final StatementContext ctx = new TestingStatementContext(new HashMap<String, Object>()); final String getIngredients = locator.locate("getIngredients", ctx); Assert.assertEquals("select tea\n" + ", mushroom\n" + ", sugar from kombucha;", getIngredients); // Test statement locator from base template group final String awesomeness = locator.locate("awesomeness", ctx); Assert.assertEquals("awesomeness;", awesomeness); }