// Path: moshas/src/main/java/net/unit8/moshas/context/Context.java
// public class Context extends AbstractContext {
// 
//     public Context() {
//         super();
//     }
// 
//     public Context(Map<String, Object> variables) {
//         super();
//         for (Map.Entry<String, Object> entry : variables.entrySet()) {
//             setVariable(entry.getKey(), entry.getValue());
//         }
//     }
// }
// 
// Path: moshas/src/main/java/net/unit8/moshas/loader/TemplateNotFoundException.java
// public class TemplateNotFoundException extends RuntimeException {
//     public TemplateNotFoundException(String msg) {
//         super(msg);
//     }
//     
//     public TemplateNotFoundException(String msg, Exception cause) {
//         super(msg, cause);
//     }
// }
// 
// Path: moshas/src/main/java/net/unit8/moshas/RenderUtils.java
// public static RenderFunction text(String... keys) {
//     return (el, ctx) -> el.text(ctx.getString(keys));
// }


import net.unit8.moshas.context.Context;
import net.unit8.moshas.loader.TemplateNotFoundException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.io.StringWriter;
import java.util.Locale;
import static net.unit8.moshas.RenderUtils.text;
        return new Object[][]{
                {new MoshasEngine()},
                {new MoshasEngine(new StandardTemplateManager(new ConcurrentHashMapTemplateCache()))}
        };
    }

    @Test(expected = TemplateNotFoundException.class)
    public void test() {
        engine.describe("notfound", t -> {});
    }

    @Test
    public void test1() {
        Template template = engine.describe("META-INF/templates/index.html", t -> {});
        Context context = new Context();
        StringWriter writer = new StringWriter();
        template.render(context, writer);
        System.out.println(writer.toString());
    }

    @Test
    public void variableNotFound() {
        Template template = engine.describe("META-INF/templates/index.html", t -> t.select("#message", text("message", "japanese")));
        Context context = new Context();
        StringWriter writer = new StringWriter();
        template.render(context, writer);
    }

    @Test
    public void conversionError() {
// Path: moshas/src/main/java/net/unit8/moshas/context/Context.java
// public class Context extends AbstractContext {
// 
//     public Context() {
//         super();
//     }
// 
//     public Context(Map<String, Object> variables) {
//         super();
//         for (Map.Entry<String, Object> entry : variables.entrySet()) {
//             setVariable(entry.getKey(), entry.getValue());
//         }
//     }
// }
// 
// Path: moshas/src/main/java/net/unit8/moshas/loader/TemplateNotFoundException.java
// public class TemplateNotFoundException extends RuntimeException {
//     public TemplateNotFoundException(String msg) {
//         super(msg);
//     }
//     
//     public TemplateNotFoundException(String msg, Exception cause) {
//         super(msg, cause);
//     }
// }
// 
// Path: moshas/src/main/java/net/unit8/moshas/RenderUtils.java
// public static RenderFunction text(String... keys) {
//     return (el, ctx) -> el.text(ctx.getString(keys));
// }


// Path: moshas/src/test/java/net/unit8/moshas/MoshasEngineTest.java
import net.unit8.moshas.context.Context;
import net.unit8.moshas.loader.TemplateNotFoundException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.io.StringWriter;
import java.util.Locale;
import static net.unit8.moshas.RenderUtils.text;

        return new Object[][]{
                {new MoshasEngine()},
                {new MoshasEngine(new StandardTemplateManager(new ConcurrentHashMapTemplateCache()))}
        };
    }

    @Test(expected = TemplateNotFoundException.class)
    public void test() {
        engine.describe("notfound", t -> {});
    }

    @Test
    public void test1() {
        Template template = engine.describe("META-INF/templates/index.html", t -> {});
        Context context = new Context();
        StringWriter writer = new StringWriter();
        template.render(context, writer);
        System.out.println(writer.toString());
    }

    @Test
    public void variableNotFound() {
        Template template = engine.describe("META-INF/templates/index.html", t -> t.select("#message", text("message", "japanese")));
        Context context = new Context();
        StringWriter writer = new StringWriter();
        template.render(context, writer);
    }

    @Test
    public void conversionError() {
        Template template = engine.describe("META-INF/templates/index.html", t -> t.select("#message", (el, ctx) -> el.text(String.format(Locale.US, "%.2f", ctx.getDouble("message")))));