<commit_before>package org.schoellerfamily.gedbrowser.controller.test;

import static org.assertj.core.api.BDDAssertions.then;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.schoellerfamily.gedbrowser.Application;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.embedded.LocalServerPort;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
 * @author <NAME>
 */
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = Application.class,
    webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@TestPropertySource(properties = {"management.port=0"})
@SuppressWarnings("PMD.JUnitTestsShouldIncludeAssert")
public class HeadControllerTest {
    /**
     * Not sure what this is good for.
     */
    @Autowired
    private TestRestTemplate testRestTemplate;

    /**
     * Server port.
     */
    @LocalServerPort
    private int port;

    /** */
    @Test
    public final void testHeadController() {
        final String url = "http://localhost:" + port
                + "/gedbrowser/head?db=gl120368";
        final ResponseEntity<String> entity = testRestTemplate.getForEntity(url,
                String.class);

        then(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
//        then(entity.getBody()).contains(
//                "<title>Person: I4 - Living </title>");
    }
}
<commit_msg>Fixes #403 - expand head controller test<commit_after>package org.schoellerfamily.gedbrowser.controller.test;

import static org.assertj.core.api.BDDAssertions.then;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.schoellerfamily.gedbrowser.Application;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.embedded.LocalServerPort;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
 * @author <NAME>
 */
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = Application.class,
    webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@TestPropertySource(properties = {"management.port=0"})
@SuppressWarnings("PMD.JUnitTestsShouldIncludeAssert")
public class HeadControllerTest {
    /**
     * Not sure what this is good for.
     */
    @Autowired
    private TestRestTemplate testRestTemplate;

    /**
     * Server port.
     */
    @LocalServerPort
    private int port;

    /** */
    @Test
    public final void testHeadController() {
        final String url = "http://localhost:" + port
                + "/gedbrowser/head?db=gl120368";
        final ResponseEntity<String> entity = testRestTemplate.getForEntity(url,
                String.class);

        then(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
        then(entity.getBody())
            .contains("<title>Header</title>")
            .contains("File:</span> C:\\Users\\Phil\\Documents\\W0803.GED")
            .contains("GEDCOM:</span> 5.5, LINEAGE-LINKED")
            .contains("Character Set:</span> ANSI")
            .contains("Destination:</span> FTM")
            .contains("Submittor:</span> <a class=\"name\""
                    + " href=\"submittor?db=gl120368&amp;id=U1\"><NAME>"
                    + " <span class=\"surname\">?</span> [U1]</a>");
    }

    /** */
    @Test
    public final void testHeadControllerSchoeller() {
        final String url = "http://localhost:" + port
                + "/gedbrowser/head?db=schoeller";
        final ResponseEntity<String> entity = testRestTemplate.getForEntity(url,
                String.class);

        then(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
        then(entity.getBody())
            .contains("<title>Header</title>")
            .contains("Submittor:</span> <a class=\"name\""
                    + " href=\"submittor?db=schoeller&amp;id=SUB1\">Richard"
                    + " <span class=\"surname\">Schoeller</span> [SUB1]</a>")
            .contains("GEDCOM:</span> 5.5.1, LINEAGE-LINKED")
            .contains("Destination:</span> GED55")
            .contains("Character Set:</span> ANSI");
    }
}

{'fraction_non_alphanumeric': 0.13327619455753162, 'fraction_numerical': 0.009642168416541676, 'mean_word_length': 3.298342541436464, 'pattern_counts': {'":': 0, '<': 32, '<?xml version=': 0, '>': 32, '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': '381688', 'n_tokens_mistral': 1352, 'n_tokens_neox': 1334, 'n_words': 211}