### Question:
MiruSoyRenderer { public String render(String template, Map<String, ?> data) { Preconditions.checkArgument(template != null && !template.isEmpty(), "argument is null or empty [template]"); Preconditions.checkNotNull(data, "argument is null [data]"); SoyTofu.Renderer renderer = tofu.newRenderer(template); if (renderer == null) { throw new IllegalArgumentException("No renderer found for template : " + template + ". Are you sure it exists?"); } renderer.setData(soyDataUtils.toSoyCompatibleMap(data)); return renderer.render(); } MiruSoyRenderer(SoyTofu tofu, SoyDataUtils soyDataUtils); String render(String template, Map<String, ?> data);  }### Answer:
@Test public void testConvertMiruHost() throws Exception { SoyFileSet.Builder builder = new SoyFileSet.Builder(); File soyFile = File.createTempFile("dumb", "soy"); try (FileWriter writer = new FileWriter(soyFile)) { writer.write("{namespace miru}\n\n" + "\n" + "{template .test}\n" + "{$host.logicalName}\n" + "{/template}\n"); } builder.add(soyFile); MiruSoyRenderer renderer = new MiruSoyRenderer(builder.build().compileToTofu(), new SoyDataUtils()); MiruHost host = new MiruHost("localhost"); Map<String, ?> data = ImmutableMap.of("host", host); String rendered = renderer.render("miru.test", data); assertEquals(rendered, host.getLogicalName()); }
@Test public void testConvertMiruBackingStorage() throws Exception { SoyFileSet.Builder builder = new SoyFileSet.Builder(); File soyFile = File.createTempFile("dumb", "soy"); try (FileWriter writer = new FileWriter(soyFile)) { writer.write("{namespace miru}\n\n" + "\n" + "{template .test}\n" + "{$storage}\n" + "{/template}\n"); } builder.add(soyFile); MiruSoyRenderer renderer = new MiruSoyRenderer(builder.build().compileToTofu(), new SoyDataUtils()); MiruBackingStorage storage = MiruBackingStorage.disk; Map<String, ?> data = ImmutableMap.of("storage", storage); String rendered = renderer.render("miru.test", data); assertEquals(rendered, storage.name()); }