CustomCategoryURLGenerator g1 = new CustomCategoryURLGenerator(); // you can add a null list - it would have been better if this // required EMPTY_LIST g1.addURLSeries(null); assertEquals(1, g1.getListCount()); assertEquals(0, g1.getURLCount(0)); List list1 = new java.util.ArrayList(); list1.add("URL1"); g1.addURLSeries(list1); assertEquals(2, g1.getListCount()); assertEquals(0, g1.getURLCount(0)); assertEquals(1, g1.getURLCount(1)); assertEquals("URL1", g1.getURL(1, 0)); // if we modify the original list, it's best if the URL generator is // not affected list1.clear(); assertEquals("URL1", g1.getURL(1, 0));
CustomXYURLGenerator g1 = new CustomXYURLGenerator(); // you can add a null list - it would have been better if this // required EMPTY_LIST g1.addURLSeries(null); assertEquals(1, g1.getListCount()); assertEquals(0, g1.getURLCount(0)); List list1 = new java.util.ArrayList(); list1.add("URL1"); g1.addURLSeries(list1); assertEquals(2, g1.getListCount()); assertEquals(0, g1.getURLCount(0)); assertEquals(1, g1.getURLCount(1)); assertEquals("URL1", g1.getURL(1, 0)); // if we modify the original list, it's best if the URL generator is // not affected list1.clear(); assertEquals("URL1", g1.getURL(1, 0));
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/urls/junit/CustomCategoryURLGeneratorTests.java File path: /jfreechart-1.0.10/tests/org/jfree/chart/urls/junit/CustomXYURLGeneratorTests.java
Method name: void testAddURLSeries() Method name: void testAddURLSeries()
Number of AST nodes: 13 Number of AST nodes: 13
1
CustomCategoryURLGenerator g1 = new CustomCategoryURLGenerator();
1
CustomXYURLGenerator g1 = new CustomXYURLGenerator();
2
        // you can add a null list - it would have been better if this
2
        // you can add a null list - it would have been better if this
3
        // required EMPTY_LIST
3
        // required EMPTY_LIST
4
        g1.addURLSeries(null);
4
        g1.addURLSeries(null);
5
        assertEquals(1, g1.getListCount());
5
        assertEquals(1, g1.getListCount());
6
        assertEquals(0, g1.getURLCount(0));
6
        assertEquals(0, g1.getURLCount(0));
7
        List list1 = new java.util.ArrayList();
7
        List list1 = new java.util.ArrayList();
8
        list1.add("URL1");
8
        list1.add("URL1");
9
        g1.addURLSeries(list1);
9
        g1.addURLSeries(list1);
10
        assertEquals(2, g1.getListCount());
10
        assertEquals(2, g1.getListCount());
11
        assertEquals(0, g1.getURLCount(0));
11
        assertEquals(0, g1.getURLCount(0));
12
        assertEquals(1, g1.getURLCount(1));
12
        assertEquals(1, g1.getURLCount(1));
13
        assertEquals("URL1", g1.getURL(1, 0));
13
        assertEquals("URL1", g1.getURL(1, 0));
14
        // if we modify the original list, it's best if the URL generator is
14
        // if we modify the original list, it's best if the URL generator is
15
        // not affected
15
        // not affected
16
        list1.clear();
16
        list1.clear();
17
        assertEquals("URL1", g1.getURL(1, 0));
17
        assertEquals("URL1", g1.getURL(1, 0));
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 in different classes having the same super class
Number of node comparisons35
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements13
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    CustomCategoryURLGenerator g1 = new CustomCategoryURLGenerator();
    1
    CustomCategoryURLGenerator g1 = new CustomCategoryURLGenerator();
    1
    CustomXYURLGenerator g1 = new CustomXYURLGenerator();
    Differences
    Expression1Expression2Difference
    org.jfree.chart.urls.CustomCategoryURLGeneratororg.jfree.chart.urls.CustomXYURLGeneratorSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.urls.CustomCategoryURLGeneratororg.jfree.chart.urls.CustomXYURLGeneratorSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.urls.CustomCategoryURLGeneratororg.jfree.chart.urls.CustomXYURLGeneratorSUBCLASS_TYPE_MISMATCH
    1
    CustomXYURLGenerator g1 = new CustomXYURLGenerator();
    2
    g1.addURLSeries(null);
    2
    g1.addURLSeries(null);
    2
    g1.addURLSeries(null);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.urls.CustomCategoryURLGeneratororg.jfree.chart.urls.CustomXYURLGeneratorSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression g1 cannot be unified with expression g1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public void addURLSeries(List#RAW)
    2
    g1.addURLSeries(null);
    3
    assertEquals(1, g1.getListCount());
    3
    assertEquals(1, g1.getListCount());
    3
    assertEquals(1, g1.getListCount());
    Differences
    Expression1Expression2Difference
    org.jfree.chart.urls.CustomCategoryURLGeneratororg.jfree.chart.urls.CustomXYURLGeneratorSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression g1 cannot be unified with expression g1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public int getListCount()
    3
    assertEquals(1, g1.getListCount());
    4
    assertEquals(0, g1.getURLCount(0));
    4
    assertEquals(0, g1.getURLCount(0));
    4
    assertEquals(0, g1.getURLCount(0));
    Differences
    Expression1Expression2Difference
    org.jfree.chart.urls.CustomCategoryURLGeneratororg.jfree.chart.urls.CustomXYURLGeneratorSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression g1 cannot be unified with expression g1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public int getURLCount(int)
    4
    assertEquals(0, g1.getURLCount(0));
    5
    List list1 = new java.util.ArrayList();
    5
    List list1 = new java.util.ArrayList();
    6
    list1.add("URL1");
    6
    list1.add("URL1");
    7
    g1.addURLSeries(list1);
    7
    g1.addURLSeries(list1);
    7
    g1.addURLSeries(list1);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.urls.CustomCategoryURLGeneratororg.jfree.chart.urls.CustomXYURLGeneratorSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression g1 cannot be unified with expression g1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public void addURLSeries(List#RAW)
    7
    g1.addURLSeries(list1);
    8
    assertEquals(2, g1.getListCount());
    8
    assertEquals(2, g1.getListCount());
    8
    assertEquals(2, g1.getListCount());
    Differences
    Expression1Expression2Difference
    org.jfree.chart.urls.CustomCategoryURLGeneratororg.jfree.chart.urls.CustomXYURLGeneratorSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression g1 cannot be unified with expression g1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public int getListCount()
    8
    assertEquals(2, g1.getListCount());
    9
    assertEquals(0, g1.getURLCount(0));
    9
    assertEquals(0, g1.getURLCount(0));
    9
    assertEquals(0, g1.getURLCount(0));
    Differences
    Expression1Expression2Difference
    org.jfree.chart.urls.CustomCategoryURLGeneratororg.jfree.chart.urls.CustomXYURLGeneratorSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression g1 cannot be unified with expression g1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public int getURLCount(int)
    9
    assertEquals(0, g1.getURLCount(0));
    10
    assertEquals(1, g1.getURLCount(1));
    10
    assertEquals(1, g1.getURLCount(1));
    10
    assertEquals(1, g1.getURLCount(1));
    Differences
    Expression1Expression2Difference
    org.jfree.chart.urls.CustomCategoryURLGeneratororg.jfree.chart.urls.CustomXYURLGeneratorSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression g1 cannot be unified with expression g1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public int getURLCount(int)
    10
    assertEquals(1, g1.getURLCount(1));
    11
    assertEquals("URL1", g1.getURL(1, 0));
    11
    assertEquals("URL1", g1.getURL(1, 0));
    11
    assertEquals("URL1", g1.getURL(1, 0));
    Differences
    Expression1Expression2Difference
    org.jfree.chart.urls.CustomCategoryURLGeneratororg.jfree.chart.urls.CustomXYURLGeneratorSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression g1 cannot be unified with expression g1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public java.lang.String getURL(int, int)
    11
    assertEquals("URL1", g1.getURL(1, 0));
    12
    list1.clear();
    12
    list1.clear();
    13
    assertEquals("URL1", g1.getURL(1, 0));
    13
    assertEquals("URL1", g1.getURL(1, 0));
    13
    assertEquals("URL1", g1.getURL(1, 0));
    Differences
    Expression1Expression2Difference
    org.jfree.chart.urls.CustomCategoryURLGeneratororg.jfree.chart.urls.CustomXYURLGeneratorSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression g1 cannot be unified with expression g1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public java.lang.String getURL(int, int)
    13
    assertEquals("URL1", g1.getURL(1, 0));
    Precondition Violations (9)
    Row Violation
    1Expression g1 cannot be unified with expression g1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public void addURLSeries(List#RAW)
    2Expression g1 cannot be unified with expression g1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public int getListCount()
    3Expression g1 cannot be unified with expression g1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public int getURLCount(int)
    4Expression g1 cannot be unified with expression g1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public void addURLSeries(List#RAW)
    5Expression g1 cannot be unified with expression g1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public int getListCount()
    6Expression g1 cannot be unified with expression g1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public int getURLCount(int)
    7Expression g1 cannot be unified with expression g1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public int getURLCount(int)
    8Expression g1 cannot be unified with expression g1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public java.lang.String getURL(int, int)
    9Expression g1 cannot be unified with expression g1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public java.lang.String getURL(int, int)