ValueMarker m = new ValueMarker(1.1); m.addChangeListener(this); this.lastEvent = null; assertEquals(Color.gray, m.getOutlinePaint()); m.setOutlinePaint(Color.yellow); assertEquals(Color.yellow, m.getOutlinePaint()); assertEquals(m, this.lastEvent.getMarker()); // check null argument... m.setOutlinePaint(null); assertEquals(null, m.getOutlinePaint());
ValueMarker m = new ValueMarker(1.1); m.addChangeListener(this); this.lastEvent = null; assertEquals(Color.black, m.getLabelPaint()); m.setLabelPaint(Color.red); assertEquals(Color.red, m.getLabelPaint()); assertEquals(m, this.lastEvent.getMarker()); // check null argument... try { m.setLabelPaint(null); fail("Expected an IllegalArgumentException for null."); } catch (IllegalArgumentException e) { assertTrue(true); }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/MarkerTests.java File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/MarkerTests.java
Method name: void testGetSetOutlinePaint() Method name: void testGetSetLabelPaint()
Number of AST nodes: 9 Number of AST nodes: 10
1
ValueMarker m = new ValueMarker(1.1);
1
ValueMarker m = new ValueMarker(1.1);
2
        m.addChangeListener(this);
2
        m.addChangeListener(this);
3
        this.lastEvent = null;
3
        this.lastEvent = null;
4
        assertEquals(Color.gray, m.getOutlinePaint());
4
        assertEquals(Color.black, m.getLabelPaint());
5
        m.setOutlinePaint(Color.yellow);
5
        m.setLabelPaint(Color.red);
6
        assertEquals(Color.yellow, m.getOutlinePaint());
6
        assertEquals(Color.red, m.getLabelPaint());
7
        assertEquals(m, this.lastEvent.getMarker());
7
        assertEquals(m, this.lastEvent.getMarker());
8
        
8
        
9
        // check null argument...
9
        // check null argument...
10
        m.setOutlinePaint(null);
10
        
11
        assertEquals(null, m.getOutlinePaint());
11
try {
12
            m.setLabelPaint(null);
13
            fail("Expected an IllegalArgumentException for null.");
14
        }
15
        catch (IllegalArgumentException e) {
16
            assertTrue(true);
17
        }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones locationClones are declared in the same class
Number of node comparisons32
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    ValueMarker m = new ValueMarker(1.1);
    1
    ValueMarker m = new ValueMarker(1.1);
    2
    m.addChangeListener(this);
    2
    m.addChangeListener(this);
    3
    this.lastEvent = null;
    3
    this.lastEvent = null;
    4
    assertEquals(Color.gray, m.getOutlinePaint());
    4
    assertEquals(Color.gray, m.getOutlinePaint());
    4
    assertEquals(Color.black, m.getLabelPaint());
    Differences
    Expression1Expression2Difference
    grayblackVARIABLE_NAME_MISMATCH
    getOutlinePaintgetLabelPaintMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression m.getOutlinePaint() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression m.getLabelPaint() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    assertEquals(Color.black, m.getLabelPaint());
    5
    m.setOutlinePaint(Color.yellow);
    5
    m.setOutlinePaint(Color.yellow);
    5
    m.setLabelPaint(Color.red);
    Differences
    Expression1Expression2Difference
    yellowredVARIABLE_NAME_MISMATCH
    setOutlinePaintsetLabelPaintMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression m.setOutlinePaint(Color.yellow) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression m.setLabelPaint(Color.red) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression m.setOutlinePaint(Color.yellow) is a void method call, and thus it cannot be parameterized
    Expression m.setLabelPaint(Color.red) is a void method call, and thus it cannot be parameterized
    5
    m.setLabelPaint(Color.red);
    6
    assertEquals(Color.yellow, m.getOutlinePaint());
    6
    assertEquals(Color.yellow, m.getOutlinePaint());
    6
    assertEquals(Color.red, m.getLabelPaint());
    Differences
    Expression1Expression2Difference
    yellowredVARIABLE_NAME_MISMATCH
    getOutlinePaintgetLabelPaintMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression m.getOutlinePaint() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression m.getLabelPaint() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    assertEquals(Color.red, m.getLabelPaint());
    7
    assertEquals(m, this.lastEvent.getMarker());
    7
    assertEquals(m, this.lastEvent.getMarker());
    8
    m.setOutlinePaint(null);
    8
    m.setOutlinePaint(null);
    Preondition Violations
    Unmatched statement m.setOutlinePaint(null); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                          
    9
    assertEquals(null, m.getOutlinePaint());
    9
    assertEquals(null, m.getOutlinePaint());
    Preondition Violations
    Unmatched statement assertEquals(null,m.getOutlinePaint()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                        
    Precondition Violations (11)
    Row Violation
    1Expression m.getOutlinePaint() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression m.getLabelPaint() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression m.setOutlinePaint(Color.yellow) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression m.setLabelPaint(Color.red) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression m.setOutlinePaint(Color.yellow) is a void method call, and thus it cannot be parameterized
    6Expression m.setLabelPaint(Color.red) is a void method call, and thus it cannot be parameterized
    7Expression m.getOutlinePaint() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression m.getLabelPaint() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Unmatched statement m.setOutlinePaint(null); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10Unmatched statement assertEquals(null,m.getOutlinePaint()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    11Clone fragment #1 returns variables , while Clone fragment #2 returns variables m