ValueMarker m = new ValueMarker(1.1); m.addChangeListener(this); this.lastEvent = null; assertEquals(Color.gray, m.getPaint()); m.setPaint(Color.blue); assertEquals(Color.blue, m.getPaint()); assertEquals(m, this.lastEvent.getMarker()); // check null argument... try { m.setPaint(null); fail("Expected an IllegalArgumentException for null."); } catch (IllegalArgumentException e) { assertTrue(true); }
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());
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 testGetSetPaint() Method name: void testGetSetOutlinePaint()
Number of AST nodes: 10 Number of AST nodes: 9
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.getPaint());
4
        assertEquals(Color.gray, m.getOutlinePaint());
5
        m.setPaint(Color.blue);
5
        m.setOutlinePaint(Color.yellow);
6
        assertEquals(Color.blue, m.getPaint());
6
        assertEquals(Color.yellow, m.getOutlinePaint());
7
        assertEquals(m, this.lastEvent.getMarker());
7
        assertEquals(m, this.lastEvent.getMarker());
8
        
8
        
9
        // check null argument...
9
        // check null argument...
10
        try {
10
        
11
            m.setPaint(null);
12
            fail("Expected an IllegalArgumentException for null.");
13
        }
14
        catch (IllegalArgumentException e) {
15
            assertTrue(true);
16
        }
11
m.setOutlinePaint(null);
12
        assertEquals(null, m.getOutlinePaint());
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 comparisons31
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment2
    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.getPaint());
    4
    assertEquals(Color.gray, m.getPaint());
    4
    assertEquals(Color.gray, m.getOutlinePaint());
    Differences
    Expression1Expression2Difference
    getPaintgetOutlinePaintMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression m.getPaint() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression m.getOutlinePaint() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    assertEquals(Color.gray, m.getOutlinePaint());
    5
    m.setPaint(Color.blue);
    5
    m.setPaint(Color.blue);
    5
    m.setOutlinePaint(Color.yellow);
    Differences
    Expression1Expression2Difference
    blueyellowVARIABLE_NAME_MISMATCH
    setPaintsetOutlinePaintMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression m.setPaint(Color.blue) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression m.setOutlinePaint(Color.yellow) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression m.setPaint(Color.blue) is a void method call, and thus it cannot be parameterized
    Expression m.setOutlinePaint(Color.yellow) is a void method call, and thus it cannot be parameterized
    5
    m.setOutlinePaint(Color.yellow);
    6
    assertEquals(Color.blue, m.getPaint());
    6
    assertEquals(Color.blue, m.getPaint());
    6
    assertEquals(Color.yellow, m.getOutlinePaint());
    Differences
    Expression1Expression2Difference
    blueyellowVARIABLE_NAME_MISMATCH
    getPaintgetOutlinePaintMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression m.getPaint() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression m.getOutlinePaint() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    assertEquals(Color.yellow, m.getOutlinePaint());
    7
    assertEquals(m, this.lastEvent.getMarker());
    7
    assertEquals(m, this.lastEvent.getMarker());
                                                          
    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
    8
    m.setOutlinePaint(null);
                                                                                        
    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
    9
    assertEquals(null, m.getOutlinePaint());
    Precondition Violations (11)
    Row Violation
    1Expression m.getPaint() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression m.getOutlinePaint() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression m.setPaint(Color.blue) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression m.setOutlinePaint(Color.yellow) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression m.setPaint(Color.blue) is a void method call, and thus it cannot be parameterized
    6Expression m.setOutlinePaint(Color.yellow) is a void method call, and thus it cannot be parameterized
    7Expression m.getPaint() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression m.getOutlinePaint() 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 m , while Clone fragment #2 returns variables