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(TextAnchor.CENTER, m.getLabelTextAnchor()); m.setLabelTextAnchor(TextAnchor.BASELINE_LEFT); assertEquals(TextAnchor.BASELINE_LEFT, m.getLabelTextAnchor()); assertEquals(m, this.lastEvent.getMarker()); // check null argument... try { m.setLabelTextAnchor(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 testGetSetLabelTextAnchor()
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(
5
        m.setOutlinePaint(Color.yellow);
6
        assertEquals(Color.yellow, m.getOutlinePaint
5
TextAnchor.CENTER, m.getLabelTextAnchor());
6
        m.setLabelTextAnchor(TextAnchor.BASELINE_LEFT);
7
());
7
        assertEquals(TextAnchor.BASELINE_LEFT, m.getLabelTextAnchor());
8
        assertEquals(m, this.lastEvent.getMarker());
8
        assertEquals(m, this.lastEvent.getMarker());
9
        
9
        
10
        // check null argument...
10
        // check null argument...
11
        m.setOutlinePaint(null);
11
        
12
        assertEquals(null, m.getOutlinePaint());
12
try {
13
            m.setLabelTextAnchor(null);
14
            fail("Expected an IllegalArgumentException for null.");
15
        }
16
        catch (IllegalArgumentException e) {
17
            assertTrue(true);
18
        }
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 statements5
    Number of unmapped statements in the first code fragment4
    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(TextAnchor.CENTER, m.getLabelTextAnchor());
    Preondition Violations
    Unmatched statement assertEquals(TextAnchor.CENTER,m.getLabelTextAnchor()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4
    assertEquals(TextAnchor.CENTER, m.getLabelTextAnchor());
    4
    assertEquals(Color.gray, m.getOutlinePaint());
    4
    assertEquals(Color.gray, m.getOutlinePaint());
    Preondition Violations
    Unmatched statement assertEquals(Color.gray,m.getOutlinePaint()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                    
    5
    m.setOutlinePaint(Color.yellow);
    5
    m.setOutlinePaint(Color.yellow);
    Preondition Violations
    Unmatched statement m.setOutlinePaint(Color.yellow); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                          
                                                                                                                                      
    6
    assertEquals(TextAnchor.BASELINE_LEFT, m.getLabelTextAnchor());
    Preondition Violations
    Unmatched statement assertEquals(TextAnchor.BASELINE_LEFT,m.getLabelTextAnchor()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    assertEquals(TextAnchor.BASELINE_LEFT, m.getLabelTextAnchor());
    6
    assertEquals(Color.yellow, m.getOutlinePaint());
    6
    assertEquals(Color.yellow, m.getOutlinePaint());
    Preondition Violations
    Unmatched statement assertEquals(Color.yellow,m.getOutlinePaint()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                        
    7
    assertEquals(m, this.lastEvent.getMarker());
    7
    assertEquals(m, this.lastEvent.getMarker());
    8
    m.setOutlinePaint(null);
    8
    m.setOutlinePaint(null);
    5
    m.setLabelTextAnchor(TextAnchor.BASELINE_LEFT);
    Differences
    Expression1Expression2Difference
    nullTextAnchor.BASELINE_LEFTTYPE_COMPATIBLE_REPLACEMENT
    setOutlinePaintsetLabelTextAnchorMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression m.setOutlinePaint(null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression m.setLabelTextAnchor(TextAnchor.BASELINE_LEFT) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression m.setOutlinePaint(null) is a void method call, and thus it cannot be parameterized
    Expression m.setLabelTextAnchor(TextAnchor.BASELINE_LEFT) is a void method call, and thus it cannot be parameterized
    5
    m.setLabelTextAnchor(TextAnchor.BASELINE_LEFT);
    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
    1Unmatched statement assertEquals(TextAnchor.CENTER,m.getLabelTextAnchor()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement assertEquals(Color.gray,m.getOutlinePaint()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement m.setOutlinePaint(Color.yellow); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement assertEquals(TextAnchor.BASELINE_LEFT,m.getLabelTextAnchor()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement assertEquals(Color.yellow,m.getOutlinePaint()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Expression m.setOutlinePaint(null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression m.setLabelTextAnchor(TextAnchor.BASELINE_LEFT) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression m.setOutlinePaint(null) is a void method call, and thus it cannot be parameterized
    9Expression m.setLabelTextAnchor(TextAnchor.BASELINE_LEFT) is a void method call, and thus it cannot be parameterized
    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