<commit_before>package org.splevo.modisco.java.diffing.match;

import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;

import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import org.eclipse.emf.common.util.BasicMonitor;
import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.Match;
import org.eclipse.emf.compare.match.DefaultMatchEngine;
import org.eclipse.emf.compare.scope.IComparisonScope;
import org.eclipse.emf.compare.utils.EqualityHelper;
import org.eclipse.emf.compare.utils.IEqualityHelper;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.gmt.modisco.java.AbstractMethodDeclaration;
import org.eclipse.gmt.modisco.java.ArrayInitializer;
import org.eclipse.gmt.modisco.java.FieldDeclaration;
import org.eclipse.gmt.modisco.java.ImportDeclaration;
import org.eclipse.gmt.modisco.java.NamedElement;
import org.junit.Before;
import org.junit.Test;
import org.splevo.diffing.JavaDiffer;
import org.splevo.modisco.java.diffing.AbstractDiffingTest;
import org.splevo.modisco.java.diffing.MoDiscoJavaEqualityHelper;
import org.splevo.modisco.java.diffing.match.HierarchicalMatchEngine.EqualityStrategy;
import org.splevo.modisco.java.diffing.match.HierarchicalMatchEngine.IgnoreStrategy;
import org.splevo.modisco.java.diffing.util.PackageIgnoreChecker;
import org.splevo.modisco.util.KDMUtil;
import org.splevo.modisco.util.SimilarityChecker;

import com.google.common.cache.CacheBuilder;
import com.google.common.cache.LoadingCache;

/**
 * Test case for the hierarchical match engine. Ensures that the match stage is performed in the
 * expected way.
 */
public class HierarchicalMatchEngineTest extends AbstractDiffingTest {

    /** The package ignore checker to use. */
    private PackageIgnoreChecker packageIgnoreChecker;
    /** The equality helper to use. */
    private IEqualityHelper equalityHelper;

    /** The strategy to use to identify equality. */
    private EqualityStrategy equalityStrategy;

    /** The strategy to use to identify elements to ignore during matching. */
    private IgnoreStrategy ignoreStrategy;

    /**
     * Test the match engine to identify all matches in two equal models.
     */
    @Test<commit_msg>SPLEVO-151 Upgrade to EMF Compare 2.x Improved code quality and extracted common match engine<commit_after>package org.splevo.modisco.java.diffing.match;

import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;

import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import org.eclipse.emf.common.util.BasicMonitor;
import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.Match;
import org.eclipse.emf.compare.match.DefaultMatchEngine;
import org.eclipse.emf.compare.scope.IComparisonScope;
import org.eclipse.emf.compare.utils.EqualityHelper;
import org.eclipse.emf.compare.utils.IEqualityHelper;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.gmt.modisco.java.AbstractMethodDeclaration;
import org.eclipse.gmt.modisco.java.ArrayInitializer;
import org.eclipse.gmt.modisco.java.FieldDeclaration;
import org.eclipse.gmt.modisco.java.ImportDeclaration;
import org.eclipse.gmt.modisco.java.NamedElement;
import org.junit.Before;
import org.junit.Test;
import org.splevo.diffing.JavaDiffer;
import org.splevo.diffing.match.HierarchicalMatchEngine;
import org.splevo.diffing.match.HierarchicalMatchEngine.EqualityStrategy;
import org.splevo.diffing.match.HierarchicalMatchEngine.IgnoreStrategy;
import org.splevo.modisco.java.diffing.AbstractDiffingTest;
import org.splevo.modisco.java.diffing.MoDiscoJavaEqualityHelper;
import org.splevo.modisco.java.diffing.util.PackageIgnoreChecker;
import org.splevo.modisco.util.KDMUtil;
import org.splevo.modisco.util.SimilarityChecker;

import com.google.common.cache.CacheBuilder;
import com.google.common.cache.LoadingCache;

/**
 * Test case for the hierarchical match engine. Ensures that the match stage is performed in the
 * expected way.
 */
public class HierarchicalMatchEngineTest extends AbstractDiffingTest {

    /** The package ignore checker to use. */
    private PackageIgnoreChecker packageIgnoreChecker;
    /** The equality helper to use. */
    private IEqualityHelper equalityHelper;

    /** The strategy to use to identify equality. */
    private EqualityStrategy equalityStrategy;

    /** The strategy to use to identify elements to ignore during matching. */
    private IgnoreStrategy ignoreStrategy;

    /**
     * Test the match engine to identify all matches in two equal models.
     */
    @Test
{'fraction_non_alphanumeric': 0.0933949547467745, 'fraction_numerical': 0.0007702676680146351, 'mean_word_length': 5.198090692124105, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6653819', 'n_tokens_mistral': 1585, 'n_tokens_neox': 1574, 'n_words': 334}