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.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 testGetSetPaint() Method name: void testGetSetLabelPaint()
Number of AST nodes: 10 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.getPaint());
4
        assertEquals(Color.black, m.getLabelPaint());
5
        m.setPaint(Color.blue);
5
        m.setLabelPaint(Color.red);
6
        assertEquals(Color.blue, m.getPaint());
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
        try {
10
        try {
11
            m.setPaint(null);
11
            m.setLabelPaint(null);
12
            fail("Expected an IllegalArgumentException for null.");
12
            fail("Expected an IllegalArgumentException for null.");
13
        }
13
        }
14
        catch (IllegalArgumentException e) {
14
        catch (IllegalArgumentException e) {
15
            assertTrue(true);
15
            assertTrue(true);
16
        }
16
        }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.1
Clones locationClones are declared in the same class
Number of node comparisons31
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements10
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)10.9
    Clone typeType 2
    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.black, m.getLabelPaint());
    Differences
    Expression1Expression2Difference
    grayblackVARIABLE_NAME_MISMATCH
    getPaintgetLabelPaintMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression m.getPaint() 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.setPaint(Color.blue);
    5
    m.setPaint(Color.blue);
    5
    m.setLabelPaint(Color.red);
    Differences
    Expression1Expression2Difference
    blueredVARIABLE_NAME_MISMATCH
    setPaintsetLabelPaintMETHOD_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.setLabelPaint(Color.red) 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.setLabelPaint(Color.red) is a void method call, and thus it cannot be parameterized
    5
    m.setLabelPaint(Color.red);
    6
    assertEquals(Color.blue, m.getPaint());
    6
    assertEquals(Color.blue, m.getPaint());
    6
    assertEquals(Color.red, m.getLabelPaint());
    Differences
    Expression1Expression2Difference
    blueredVARIABLE_NAME_MISMATCH
    getPaintgetLabelPaintMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression m.getPaint() 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
    try
    8
    try
    9
    m.setPaint(null);
    9
    m.setPaint(null);
    9
    m.setLabelPaint(null);
    Differences
    Expression1Expression2Difference
    setPaintsetLabelPaintMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression m.setPaint(null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression m.setLabelPaint(null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression m.setPaint(null) is a void method call, and thus it cannot be parameterized
    Expression m.setLabelPaint(null) is a void method call, and thus it cannot be parameterized
    9
    m.setLabelPaint(null);
    10
    fail("Expected an IllegalArgumentException for null.");
    10
    fail("Expected an IllegalArgumentException for null.");
    Precondition Violations (12)
    Row Violation
    1Expression m.getPaint() 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.setPaint(Color.blue) 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.setPaint(Color.blue) 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.getPaint() 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
    9Expression m.setPaint(null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression m.setLabelPaint(null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression m.setPaint(null) is a void method call, and thus it cannot be parameterized
    12Expression m.setLabelPaint(null) is a void method call, and thus it cannot be parameterized