Skip to main content
summaryrefslogtreecommitdiffstats
blob: b3e8bcbd20112979e50f8f7cdd0ce6c9cb27e139 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package org.eclipse.emf.compare.uml2.tests.nonreg.bug484576_pseudoconflicts;

import static com.google.common.collect.Collections2.filter;
import static org.junit.Assert.assertEquals;

import com.google.common.base.Predicate;

import java.io.IOException;

import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.Conflict;
import org.eclipse.emf.compare.ConflictKind;
import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
import org.eclipse.emf.compare.uml2.tests.AbstractUMLTest;
import org.eclipse.emf.compare.uml2.tests.nonreg.bug484576_pseudoconflicts.data.NonReg484576Data;
import org.eclipse.emf.ecore.resource.Resource;
import org.junit.Test;

/**
 * This test makes sure that bug 484576 is fixed. It means checking that pseudo-conflicts contain only
 * equivalent diffs on each side and don't aggregate several unrelated diffs.
 * 
 * @author <a href="mailto:laurent.delaigue@obeo.fr">Laurent Delaigue</a>
 */
public class TestNonRegPseudoConflict_484576 extends AbstractUMLTest {

	private NonReg484576Data input = new NonReg484576Data();

	@Test
	public void testOnePseudoConflictPerDiff() throws IOException {
		final Resource ancestor = input.getAncestor();
		final Resource left = input.getLeft();
		final Resource right = input.getRight();

		final Comparison comparison = compare(left, right, ancestor);

		assertEquals(3, comparison.getConflicts().size());
		assertEquals(2, filter(comparison.getConflicts(), new Predicate<Conflict>() {
			public boolean apply(Conflict conflict) {
				return conflict.getKind() == ConflictKind.PSEUDO;
			}
		}).size());
	}

	@Override
	protected AbstractUMLInputData getInput() {
		return input;
	}
}

Back to the top