/**
 * redpen: a text inspection tool
 * Copyright (c) 2014-2015 Recruit Technologies Co., Ltd. and contributors
 * (see CONTRIBUTORS.md)
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package cc.redpen.validator.document;

import cc.redpen.RedPen;
import cc.redpen.RedPenException;
import cc.redpen.config.Configuration;
import cc.redpen.config.ValidatorConfiguration;
import cc.redpen.model.Document;
import cc.redpen.validator.BaseValidatorTest;
import cc.redpen.validator.ValidationError;
import org.junit.jupiter.api.Test;

import java.util.List;
import java.util.Map;

import static java.util.Collections.singletonList;
import static org.junit.jupiter.api.Assertions.assertEquals;

public class JapaneseExpressionVariationValidatorTest extends BaseValidatorTest {
    protected JapaneseExpressionVariationValidatorTest() {
        super("JapaneseExpressionVariation");
    }

    @Test
    void detectSameReadingsInJapaneseCharacters() throws RedPenException {
        config = Configuration.builder("ja")
                         .addValidatorConfig(new ValidatorConfiguration(validatorName))
                         .build();

        Document document = prepareSimpleDocument("之は山です。これは川です。");

        RedPen redPen = new RedPen(config);
        Map<Document, List<ValidationError>> errors = redPen.validate(singletonList(document));
        assertEquals(1, errors.get(document).size());
    }

    @Test
    void detectSameReadingsInJapaneseCharactersInDefaultDictionary() throws RedPenException {
        config = Configuration.builder("ja")
                         .addValidatorConfig(new ValidatorConfiguration(validatorName))
                         .build();

        Document document = prepareSimpleDocument("nodeは英語です。ノードはカタカナです。");

        RedPen redPen = new RedPen(config);
        Map<Document, List<ValidationError>> errors = redPen.validate(singletonList(document));
        assertEquals(1, errors.get(document).size());
    }

    @Test
    void detectSameReadingsInJapaneseCharactersInDefaultDictionaryWithUpperCase() throws RedPenException {
        config = Configuration.builder("ja")
                         .addValidatorConfig(new ValidatorConfiguration(validatorName))
                         .build();

        Document document = prepareSimpleDocument("Nodeは英語です。ノードはカタカナです。");

        RedPen redPen = new RedPen(config);
        Map<Document, List<ValidationError>> errors = redPen.validate(singletonList(document));
        assertEquals(1, errors.get(document).size());
    }

    @Test
    void detectSameAlphabecicalReadings() throws RedPenException {
        config = Configuration.builder("ja")
                .addValidatorConfig(new ValidatorConfiguration(validatorName))
                .build();

        Document document = prepareSimpleDocument("このExcelはあのエクセルとは違います。");

        RedPen redPen = new RedPen(config);
        Map<Document, List<ValidationError>> errors = redPen.validate(singletonList(document));
        assertEquals(1, errors.get(document).size());
    }

    @Test
    void detectMultipleSameReadings() throws RedPenException {
        config = Configuration.builder("ja")
                .addValidatorConfig(new ValidatorConfiguration(validatorName))
                .build();

        Document document = prepareSimpleDocument("このExcelはあのエクセルともこのエクセルとも違います。");

        RedPen redPen = new RedPen(config);
        Map<Document, List<ValidationError>> errors = redPen.validate(singletonList(document));
        assertEquals(1, errors.get(document).size());
    }
}

@@ -3167,32 +3167,41 @@
                 
+         
 .addValidatorCon
@@ -3239,32 +3239,41 @@
 validatorName))%0A
+         
                 
@@ -3546,39 +3546,624 @@
 ument).size());%0A
-
     %7D%0A%0A
+%0A    @Test%0A    void detectSameAlphabecicalReadingsInUserDictionary() throws RedPenException %7B%0A        config = Configuration.builder(%22ja%22)%0A                         .addValidatorConfig(new ValidatorConfiguration(validatorName).addProperty(%22map%22, %22%7Bsvm,%E3%82%B5%E3%83%9D%E3%83%BC%E3%83%88%E3%83%99%E3%82%AF%E3%82%BF%E3%83%9E%E3%82%B7%E3%83%B3%7D%22))%0A                         .build();%0A%0A        Document document = prepareSimpleDocument(%22%E3%81%93%E3%81%AESVM%E3%81%AF%E3%81%82%E3%81%AE%E3%82%B5%E3%83%9D%E3%83%BC%E3%83%88%E3%83%99%E3%82%AF%E3%82%BF%E3%83%9E%E3%82%B7%E3%83%B3%E3%81%A8%E3%81%AF%E9%81%95%E3%81%84%E3%81%BE%E3%81%99%E3%80%82%22);%0A%0A        RedPen redPen = new RedPen(config);%0A        Map%3CDocument, List%3CValidationError%3E%3E errors = redPen.validate(singletonList(document));%0A        assertEquals(1, errors.get(document).size());%0A    %7D%0A%0A%0A
     @Test%0A    vo

Add test for user dictionary in JapaneseExpressionVariationValidator