ValueMarker m = new ValueMarker(1.1); m.addChangeListener(this); this.lastEvent = null; assertEquals(new BasicStroke(0.5f), m.getStroke()); m.setStroke(new BasicStroke(1.1f)); assertEquals(new BasicStroke(1.1f), m.getStroke()); assertEquals(m, this.lastEvent.getMarker()); // check null argument... try { m.setStroke(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(new BasicStroke(0.5f), m.getOutlineStroke()); m.setOutlineStroke(new BasicStroke(1.1f)); assertEquals(new BasicStroke(1.1f), m.getOutlineStroke()); assertEquals(m, this.lastEvent.getMarker()); // check null argument... m.setOutlineStroke(null); assertEquals(null, m.getOutlineStroke());
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 testGetSetStroke() Method name: void testGetSetOutlineStroke()
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(new BasicStroke(0.5f), m.getStroke());
4
        assertEquals(new BasicStroke(0.5f), m.getOutlineStroke());
5
        m.setStroke(new BasicStroke(1.1f));
5
        m.setOutlineStroke(new BasicStroke(1.1f));
6
        assertEquals(new BasicStroke(1.1f), m.getStroke());
6
        assertEquals(new BasicStroke(1.1f), m.getOutlineStroke());
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.setStroke(null);
11
m.setOutlineStroke(null);
12
            fail("Expected an IllegalArgumentException for null.");
12
        
13
        }
14
        catch (IllegalArgumentException e) {
15
            assertTrue(true);
16
        }
13
assertEquals(null, m.getOutlineStroke());
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(new BasicStroke(0.5f), m.getStroke());
    4
    assertEquals(new BasicStroke(0.5f), m.getStroke());
    4
    assertEquals(new BasicStroke(0.5f), m.getOutlineStroke());
    Differences
    Expression1Expression2Difference
    getStrokegetOutlineStrokeMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression m.getStroke() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression m.getOutlineStroke() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    assertEquals(new BasicStroke(0.5f), m.getOutlineStroke());
    5
    m.setStroke(new BasicStroke(1.1f));
    5
    m.setStroke(new BasicStroke(1.1f));
    5
    m.setOutlineStroke(new BasicStroke(1.1f));
    Differences
    Expression1Expression2Difference
    setStrokesetOutlineStrokeMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression m.setStroke(new BasicStroke(1.1f)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression m.setOutlineStroke(new BasicStroke(1.1f)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression m.setStroke(new BasicStroke(1.1f)) is a void method call, and thus it cannot be parameterized
    Expression m.setOutlineStroke(new BasicStroke(1.1f)) is a void method call, and thus it cannot be parameterized
    5
    m.setOutlineStroke(new BasicStroke(1.1f));
    6
    assertEquals(new BasicStroke(1.1f), m.getStroke());
    6
    assertEquals(new BasicStroke(1.1f), m.getStroke());
    6
    assertEquals(new BasicStroke(1.1f), m.getOutlineStroke());
    Differences
    Expression1Expression2Difference
    getStrokegetOutlineStrokeMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression m.getStroke() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression m.getOutlineStroke() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    assertEquals(new BasicStroke(1.1f), m.getOutlineStroke());
    7
    assertEquals(m, this.lastEvent.getMarker());
    7
    assertEquals(m, this.lastEvent.getMarker());
                                                            
    8
    m.setOutlineStroke(null);
    Preondition Violations
    Unmatched statement m.setOutlineStroke(null); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8
    m.setOutlineStroke(null);
                                                                                          
    9
    assertEquals(null, m.getOutlineStroke());
    Preondition Violations
    Unmatched statement assertEquals(null,m.getOutlineStroke()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9
    assertEquals(null, m.getOutlineStroke());
    Precondition Violations (11)
    Row Violation
    1Expression m.getStroke() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression m.getOutlineStroke() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression m.setStroke(new BasicStroke(1.1f)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression m.setOutlineStroke(new BasicStroke(1.1f)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression m.setStroke(new BasicStroke(1.1f)) is a void method call, and thus it cannot be parameterized
    6Expression m.setOutlineStroke(new BasicStroke(1.1f)) is a void method call, and thus it cannot be parameterized
    7Expression m.getStroke() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression m.getOutlineStroke() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Unmatched statement m.setOutlineStroke(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.getOutlineStroke()); 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