<commit_before>package uk.gov.register.thymeleaf;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.internal.util.collections.Sets;
import org.mockito.runners.MockitoJUnitRunner;
import uk.gov.register.presentation.config.Register;
import uk.gov.register.presentation.resource.RequestContext;

import java.time.LocalDateTime;

import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.when;

@RunWith(MockitoJUnitRunner.class)
public class HomePageViewTest {

    @Mock
    RequestContext mockRequestContext;

    @Test
    public void getRegisterText_rendersRegisterTextAsMarkdown() throws Exception {
        HomePageView homePageView = new HomePageView(null, null, mockRequestContext, 1, null, ".openregister.org");

        String registerText = "foo *bar* [baz](/quux)";
        when(mockRequestContext.getRegister()).thenReturn(new Register("", Sets.newSet(), "", "", registerText));

        String result = homePageView.getRegisterText();

        assertThat(result, equalTo("<p>foo <em>bar</em> <a href=\"/quux\">baz</a></p>\n"));
    }

    @Test
    public void getLastUpdatedTime_formatsTheLocalDateTimeToUKDateTimeFormat() {
        LocalDateTime localDateTime = LocalDateTime.of(2015, 9, 11, 13, 17, 59, 543);

        HomePageView homePageView = new HomePageView(null, null, mockRequestContext, 1, localDateTime, ".openregister.org");

        assertThat(homePageView.getLastUpdatedTime(), equalTo("11 Sep 2015"));
    }
}
<commit_msg>remove dots from test data for consistency<commit_after>package uk.gov.register.thymeleaf;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.internal.util.collections.Sets;
import org.mockito.runners.MockitoJUnitRunner;
import uk.gov.register.presentation.config.Register;
import uk.gov.register.presentation.resource.RequestContext;

import java.time.LocalDateTime;

import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.when;

@RunWith(MockitoJUnitRunner.class)
public class HomePageViewTest {

    @Mock
    RequestContext mockRequestContext;

    @Test
    public void getRegisterText_rendersRegisterTextAsMarkdown() throws Exception {
        HomePageView homePageView = new HomePageView(null, null, mockRequestContext, 1, null, "openregister.org");

        String registerText = "foo *bar* [baz](/quux)";
        when(mockRequestContext.getRegister()).thenReturn(new Register("", Sets.newSet(), "", "", registerText));

        String result = homePageView.getRegisterText();

        assertThat(result, equalTo("<p>foo <em>bar</em> <a href=\"/quux\">baz</a></p>\n"));
    }

    @Test
    public void getLastUpdatedTime_formatsTheLocalDateTimeToUKDateTimeFormat() {
        LocalDateTime localDateTime = LocalDateTime.of(2015, 9, 11, 13, 17, 59, 543);

        HomePageView homePageView = new HomePageView(null, null, mockRequestContext, 1, localDateTime, "openregister.org");

        assertThat(homePageView.getLastUpdatedTime(), equalTo("11 Sep 2015"));
    }
}

{'fraction_non_alphanumeric': 0.12006319115323855, 'fraction_numerical': 0.015165876777251185, 'mean_word_length': 4.766848816029144, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7149339', 'n_tokens_mistral': 994, 'n_tokens_neox': 930, 'n_words': 190}