<commit_before>package de.codecentric.gradle.plugin.opencms.files

import org.junit.After
import org.junit.Before
import org.junit.Test

import static org.junit.Assert.assertEquals

public class OpenCmsVfsFileTest {
    OpenCmsVfsFile file

    @Before
    public void setUp() {
        file = new OpenCmsVfsFile();
        file.builder.doubleQuotes = true;
        file.path = "/path"
        file.type = "test"
        file.date = new Date()
    }

    @Test
    public void shouldCreateMarkupFile() {
        file.prepareMetadata("Admin")
        assertEquals("<file>\n" +
                "  <source>/path</source>\n" +
                "  <destination>/path</destination>\n" +
                "  <type>test</type>\n" +
                "  <uuidstructure></uuidstructure>\n" +
                "  <uuidresource></uuidresource>\n" +
                "  <datelastmodified>${file.date.format("EEE, d MMM yyyy HH:mm:ss z")}</datelastmodified>\n" +
                "  <userlastmodified>Admin</userlastmodified>\n" +
                "  <datecreated>${file.date.format("EEE, d MMM yyyy HH:mm:ss z")}</datecreated>\n" +
                "  <usercreated>Admin</usercreated>\n" +
                "  <flags>0</flags>\n" +
                "  <properties />\n" +
                "  <relations />\n" +
                "  <accesscontrol />\n" +
                "</file>", file.stringWriter.toString().replaceAll(/<(uuid\w+)>.+<\/(uuid\w+)>/, "<\$1></\$2>"))
    }

    @Test
    public void shouldReturnFormattedDate() throws Exception {
        file.date = new Date(0)
        assertEquals("Thu, 1 Jan 1970 01:00:00 CET", file.now())
    }

    @Test
    public void shouldYieldUnescapedCdataAsTextNode() throws Exception {
        file.builder.root() { file.cdata("Äöü") }
        assertEquals("<root><![CDATA[Äöü]]></root>", file.stringWriter.toString())
    }

    @Test
    public void shouldReturnStringWithUppercaseFirstLetter() throws Exception {
        assertEquals("Something", file.toFirstUpper("something"))
    }

    @Test
    public void shouldClearTheStringWriterForNewInput() throws Exception {
        file.prepareMetadata("Admin")
        file.clearStringWriter()
        assertEquals("", file.stringWriter.toString())
    }<commit_msg>Make test independend from system locale<commit_after>package de.codecentric.gradle.plugin.opencms.files

import org.junit.After
import org.junit.Before
import org.junit.Test

import static org.junit.Assert.assertEquals

public class OpenCmsVfsFileTest {
    OpenCmsVfsFile file

    @Before
    public void setUp() {
        file = new OpenCmsVfsFile();
        file.builder.doubleQuotes = true;
        file.path = "/path"
        file.type = "test"
        file.date = new Date()
    }

    @Test
    public void shouldCreateMarkupFile() {
        file.prepareMetadata("Admin")
        assertEquals("<file>\n" +
                "  <source>/path</source>\n" +
                "  <destination>/path</destination>\n" +
                "  <type>test</type>\n" +
                "  <uuidstructure></uuidstructure>\n" +
                "  <uuidresource></uuidresource>\n" +
                "  <datelastmodified>${file.date.format("EEE, d MMM yyyy HH:mm:ss z")}</datelastmodified>\n" +
                "  <userlastmodified>Admin</userlastmodified>\n" +
                "  <datecreated>${file.date.format("EEE, d MMM yyyy HH:mm:ss z")}</datecreated>\n" +
                "  <usercreated>Admin</usercreated>\n" +
                "  <flags>0</flags>\n" +
                "  <properties />\n" +
                "  <relations />\n" +
                "  <accesscontrol />\n" +
                "</file>", file.stringWriter.toString().replaceAll(/<(uuid\w+)>.+<\/(uuid\w+)>/, "<\$1></\$2>"))
    }

    @Test
    public void shouldReturnFormattedDate() throws Exception {
        Locale.setDefault(Locale.ENGLISH)
        file.date = new Date(0)
        assertEquals("Thu, 1 Jan 1970 01:00:00 CET", file.now())
    }

    @Test
    public void shouldYieldUnescapedCdataAsTextNode() throws Exception {
        file.builder.root() { file.cdata("Äöü") }
        assertEquals("<root><![CDATA[Äöü]]></root>", file.stringWriter.toString())
    }

    @Test
    public void shouldReturnStringWithUppercaseFirstLetter() throws Exception {
        assertEquals("Something", file.toFirstUpper("something"))
    }

    @Test
    public void shouldClearTheStringWriterForNewInput() throws Exception {
        file.prepareMetadata("Admin")
        file.clearStringWriter()
        assertEquals("", file.stringWriter.toString())
    }
{'fraction_non_alphanumeric': 0.1486694523861887, 'fraction_numerical': 0.006597756762700682, 'mean_word_length': 2.2980420594633792, 'pattern_counts': {'":': 0, '<': 67, '<?xml version=': 0, '>': 67, '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': '6208039', 'n_tokens_mistral': 1419, 'n_tokens_neox': 1336, 'n_words': 228}