From 3395bbac49d7c23e37cb0736869d42bb8b9ab93a Mon Sep 17 00:00:00 2001 From: Barbosa Date: Wed, 20 Jan 2021 16:05:55 -0300 Subject: [PATCH] test(#31): add concat matheods test case --- ...duralOverridingAssignmentAnalysisTest.java | 11 +++++++++ ...tMethodsConflictInterProceduralSample.java | 23 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 src/test/java/br/unb/cic/analysis/samples/OverridingAssignmentConcatMethodsConflictInterProceduralSample.java diff --git a/src/test/java/br/unb/cic/analysis/ioa/InterproceduralOverridingAssignmentAnalysisTest.java b/src/test/java/br/unb/cic/analysis/ioa/InterproceduralOverridingAssignmentAnalysisTest.java index 270b5511..59e049dd 100644 --- a/src/test/java/br/unb/cic/analysis/ioa/InterproceduralOverridingAssignmentAnalysisTest.java +++ b/src/test/java/br/unb/cic/analysis/ioa/InterproceduralOverridingAssignmentAnalysisTest.java @@ -125,6 +125,17 @@ public void objectFieldNotConflict() { Assert.assertEquals(0, analysis.getConflicts().size()); } + @Test + public void concatMethodsConflict() { + String sampleClassPath = "br.unb.cic.analysis.samples.OverridingAssignmentConcatMethodsConflictInterProceduralSample"; + AbstractMergeConflictDefinition definition = DefinitionFactory + .definition(sampleClassPath, new int[]{7}, new int[]{8}); + InterproceduralOverrideAssignment analysis = new InterproceduralOverrideAssignment(definition); + configureTest(analysis); + Assert.assertEquals(1, analysis.getConflicts().size()); + } + + //@Ignore @Test public void ifBranchConflict() { String sampleClassPath = "br.unb.cic.analysis.samples.OverridingAssignmentIfBranchConflictInterProceduralSample"; diff --git a/src/test/java/br/unb/cic/analysis/samples/OverridingAssignmentConcatMethodsConflictInterProceduralSample.java b/src/test/java/br/unb/cic/analysis/samples/OverridingAssignmentConcatMethodsConflictInterProceduralSample.java new file mode 100644 index 00000000..479f683b --- /dev/null +++ b/src/test/java/br/unb/cic/analysis/samples/OverridingAssignmentConcatMethodsConflictInterProceduralSample.java @@ -0,0 +1,23 @@ +package br.unb.cic.analysis.samples; + +// Conflict: [left, m():7] --> [right, foo():8] +public class OverridingAssignmentConcatMethodsConflictInterProceduralSample { + + public void m() { + int x = foo() + bar(); // LEFT + x = x + qux(); // RIGHT + System.out.println(x); + } + + private int foo() { + return 1; + } + + private int bar() { + return 2; + } + + private int qux() { + return 3; + } +} \ No newline at end of file