<commit_before>package de.cooperateproject.modeling.transformation.transformations.tests.transforms.plain;

import static org.junit.Assert.assertEquals;

import java.util.Collections;

import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.m2m.qvt.oml.BasicModelExtent;
import org.eclipse.m2m.qvt.oml.ModelExtent;
import org.eclipse.m2m.qvt.oml.util.Trace;
import org.junit.Test;

import de.cooperateproject.modeling.textual.cls.cls.ClsPackage;

public class GraphicalToTextualClassTest extends PlainTransformationTestBase {

	private static final URI TRANSFORMATION_URI = createTransformationURI("Graphical_to_Textual_for_Class.qvto");

	static {
		ClsPackage.eINSTANCE.eClass();
	}
	
	@Test
	public void testWithoutPackages() throws Exception {
		testRegular("ClassDiagram");
	}

	@Test
	public void testWithoutPackagesIncremental() throws Exception {
		testIncremental("ClassDiagram");
	}
	
	@Test
	public void testPackages() throws Exception {
		testRegular("ClassDiagramPackages");
	}
	
	@Test
	public void testPackagesIncremental() throws Exception {
		testIncremental("ClassDiagramPackages");
	}
	
	@Test
	public void testSelfReference() throws Exception {
		testRegular("ClassDiagramSelfReference");
	}
	
	@Test
	public void testSelfReferenceIncremental() throws Exception {
		testIncremental("ClassDiagramSelfReference");
	}
	
	private void testRegular(String modelName) throws Exception {
		URI sourceModelURI = createResourceModelURI(modelName + ".notation");
		URI umlModelURI = createResourceModelURI(modelName+ ".uml");
		URI resultModelURI = createResourceModelURI(modelName + ".xmi");
		
		ModelExtent transformationResult = runTransformation(TRANSFORMATION_URI, sourceModelURI, umlModelURI);
		
		EObject expected = getRootElement(resultModelURI);
		assertEquals(1, transformationResult.getContents().size());
		EObject actual = transformationResult.getContents().get(0);
		EcoreUtil.resolveAll(getResourceSet());
		
		Resource r = getResourceSet().createResource(URI.createFileURI("asdflhasdflkj"));
		r.getContents().add(actual);
		r.save(System.out, null);
		
		assertModelEquals(expected, actual);
	}
		
	private void testIncremental(String modelName) throws Exception {<commit_msg>Removed obsolete debug code in transformation test.<commit_after>package de.cooperateproject.modeling.transformation.transformations.tests.transforms.plain;

import static org.junit.Assert.assertEquals;

import java.util.Collections;

import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.m2m.qvt.oml.BasicModelExtent;
import org.eclipse.m2m.qvt.oml.ModelExtent;
import org.eclipse.m2m.qvt.oml.util.Trace;
import org.junit.Test;

import de.cooperateproject.modeling.textual.cls.cls.ClsPackage;

public class GraphicalToTextualClassTest extends PlainTransformationTestBase {

	private static final URI TRANSFORMATION_URI = createTransformationURI("Graphical_to_Textual_for_Class.qvto");

	static {
		ClsPackage.eINSTANCE.eClass();
	}
	
	@Test
	public void testWithoutPackages() throws Exception {
		testRegular("ClassDiagram");
	}

	@Test
	public void testWithoutPackagesIncremental() throws Exception {
		testIncremental("ClassDiagram");
	}
	
	@Test
	public void testPackages() throws Exception {
		testRegular("ClassDiagramPackages");
	}
	
	@Test
	public void testPackagesIncremental() throws Exception {
		testIncremental("ClassDiagramPackages");
	}
	
	@Test
	public void testSelfReference() throws Exception {
		testRegular("ClassDiagramSelfReference");
	}
	
	@Test
	public void testSelfReferenceIncremental() throws Exception {
		testIncremental("ClassDiagramSelfReference");
	}
	
	private void testRegular(String modelName) throws Exception {
		URI sourceModelURI = createResourceModelURI(modelName + ".notation");
		URI umlModelURI = createResourceModelURI(modelName+ ".uml");
		URI resultModelURI = createResourceModelURI(modelName + ".xmi");
		
		ModelExtent transformationResult = runTransformation(TRANSFORMATION_URI, sourceModelURI, umlModelURI);
		
		EObject expected = getRootElement(resultModelURI);
		assertEquals(1, transformationResult.getContents().size());
		EObject actual = transformationResult.getContents().get(0);
		EcoreUtil.resolveAll(getResourceSet());
		
		assertModelEquals(expected, actual);
	}
		
	private void testIncremental(String modelName) throws Exception {
{'fraction_non_alphanumeric': 0.09938704028021016, 'fraction_numerical': 0.0021891418563922942, 'mean_word_length': 6.252380952380952, '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': '6083930', 'n_tokens_mistral': 1469, 'n_tokens_neox': 1350, 'n_words': 252}