<commit_before>/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.xwiki.text;

import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

/**
 * Unit tests for {@link XWikiToStringBuilder}.
 *
 * @version $Id$
 * @since 4.0M2
 */
public class XWikiToStringBuilderTest
{
    public class TestClass
    {
        private String field1 = "value1";
        private Integer field2 = 100;
        private Map<String, String> field3 = new LinkedHashMap<>();
        private List<String> field4 = Arrays.asList("value");

        public TestClass()
        {
            this.field3.put("key1", "value1");
            this.field3.put("key2", "value2");
        }

        @Override
        public String toString()
        {
            return new XWikiToStringBuilder(this)
                .append("field1", field1)
                .append("field2", field2)
                .append("field3", field3)
                .append("field4", field4)
                .toString();
        }
    }

    @Test
    public void toStringBuilder()
    {
        assertEquals("field1 = [value1], field2 = [100], field3 = [[key1] = [value1], [key2] = [value2]], "
            + "field4 = [[value]]", new TestClass().toString());
    }
}<commit_msg>[Misc] Fix warnings shown by Sonarlint<commit_after>/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.xwiki.text;

import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

/**
 * Unit tests for {@link XWikiToStringBuilder}.
 *
 * @version $Id$
 * @since 4.0M2
 */
class XWikiToStringBuilderTest
{
    public class TestClass
    {
        private String field1 = "value1";
        private Integer field2 = 100;
        private Map<String, String> field3 = new LinkedHashMap<>();
        private List<String> field4 = Arrays.asList("value");

        public TestClass()
        {
            this.field3.put("key1", "value1");
            this.field3.put("key2", "value2");
        }

        @Override
        public String toString()
        {
            return new XWikiToStringBuilder(this)
                .append("field1", field1)
                .append("field2", field2)
                .append("field3", field3)
                .append("field4", field4)
                .toString();
        }
    }

    @Test
    void toStringBuilder()
    {
        assertEquals("field1 = [value1], field2 = [100], field3 = [[key1] = [value1], [key2] = [value2]], "
            + "field4 = [[value]]", new TestClass().toString());
    }
}
{'fraction_non_alphanumeric': 0.10469557402830824, 'fraction_numerical': 0.02246686137946529, 'mean_word_length': 2.703826955074875, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5941131', 'n_tokens_mistral': 1257, 'n_tokens_neox': 1216, 'n_words': 449}