<commit_before>package examples.templating;

import com.vtence.molecule.WebServer;
import com.vtence.molecule.support.http.DeprecatedHttpRequest;
import com.vtence.molecule.support.http.DeprecatedHttpResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import java.io.IOException;

import static org.hamcrest.Matchers.containsString;

public class TemplatingAndLayoutTest {

    TemplatingAndLayoutExample templating = new TemplatingAndLayoutExample();
    WebServer server = WebServer.create(9999);

    DeprecatedHttpRequest request = new DeprecatedHttpRequest(9999);
    DeprecatedHttpResponse response;

    @Before
    public void startServer() throws IOException {
        templating.run(server);
    }

    @After
    public void stopServer() throws IOException {
        server.stop();
    }

    @Test
    public void renderingAnHtmlTemplateUsingMustache() throws IOException {
        response = request.get("/hello?name=Frodo");
        response.assertOK();
        response.assertHasContentType("text/html; charset=utf-8");
        response.assertContent(containsString("<p>Hello, Frodo!</p>"));
    }

    @Test
    public void applyingACommonLayoutToASetOfPages() throws IOException {
        response = request.get("/hello");
        response.assertOK();
        response.assertContent(containsString("<title>Layout - Hello World"));
        response.assertContent(containsString("<h1>A simple page</h1>"));
        response.assertContent(containsString("<meta name=\"description\" content=\"Hello World\">"));
        response.assertContent(containsString("Hello, World!"));
    }

    @Test
    public void skippingDecorationWhenResponseStatusIsNotOk() throws IOException {
        response = request.get("/not-found");
        response.assertHasStatusCode(404);
        response.assertContentEqualTo("Not found: /not-found");
    }
}<commit_msg>Use lite http client in templating and layout example<commit_after>package examples.templating;

import com.vtence.molecule.WebServer;
import com.vtence.molecule.test.HttpRequest;
import com.vtence.molecule.test.HttpResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import java.io.IOException;

import static com.vtence.molecule.test.HttpResponseAssert.assertThat;
import static org.hamcrest.Matchers.containsString;

public class TemplatingAndLayoutTest {

    TemplatingAndLayoutExample templating = new TemplatingAndLayoutExample();
    WebServer server = WebServer.create(9999);

    HttpRequest request = new HttpRequest(9999);
    HttpResponse response;

    @Before
    public void startServer() throws IOException {
        templating.run(server);
    }

    @After
    public void stopServer() throws IOException {
        server.stop();
    }

    @Test
    public void renderingAnHtmlTemplateUsingMustache() throws IOException {
        response = request.get("/hello?name=Frodo");
        assertThat(response).isOK()
                            .hasContentType("text/html; charset=utf-8")
                            .hasBodyText(containsString("<p>Hello, Frodo!</p>"));
    }

    @Test
    public void applyingACommonLayoutToASetOfPages() throws IOException {
        response = request.get("/hello");
        assertThat(response).isOK()
                            .hasBodyText(containsString("<title>Layout - Hello World"))
                            .hasBodyText(containsString("<h1>A simple page</h1>"))
                            .hasBodyText(containsString("<meta name=\"description\" content=\"Hello World\">"))
                            .hasBodyText(containsString("<p>Hello, World!</p>"));
    }

    @Test
    public void skippingDecorationWhenResponseStatusIsNotOk() throws IOException {
        response = request.get("/not-found");
        assertThat(response).hasStatusCode(404)
                            .hasBodyText("Not found: /not-found");
    }
}
{'fraction_non_alphanumeric': 0.11096906162106877, 'fraction_numerical': 0.007159294298133469, 'mean_word_length': 3.3083700440528636, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7058559', 'n_tokens_mistral': 1064, 'n_tokens_neox': 1032, 'n_words': 201}