URL url = new URL("http://a.b.c/"); man.addCookieFromHeader("test=1", url); String s = man.getCookieHeaderForURL(url); assertNotNull(s); assertEquals("test=1", s); man.addCookieFromHeader("test=2", url); s = man.getCookieHeaderForURL(url); assertNotNull(s); assertEquals("test=2", s);
URL url = new URL("http://order.now/sub1/moo.html"); man.addCookieFromHeader("test1=moo1;path=/", url); man.addCookieFromHeader("test2=moo2;path=/sub1", url); man.addCookieFromHeader("test2=moo3;path=/", url); assertEquals(3,man.getCookieCount()); String s = man.getCookieHeaderForURL(url); assertNotNull(s); assertEquals("test2=moo2; test1=moo1; test2=moo3", s);
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/control/TestCookieManager.java File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/control/TestCookieManager.java
Method name: void testDuplicateCookie() Method name: void testCookieOrdering1()
Number of AST nodes: 9 Number of AST nodes: 8
1
URL url = new URL("http://a.b.c/");
1
URL url = new URL("http://order.now/sub1/moo.html");
2
            man.addCookieFromHeader("test=1", url);
2
            man.addCookieFromHeader("test1=moo1;path=/", url);
3
            String s = man.getCookieHeaderForURL(url);
3
            man.addCookieFromHeader
4
            assertNotNull(s
4
("test2=moo2;path=/sub1", url);
5
);
5
            man.addCookieFromHeader("test2=moo3;path=/", url);
6
            assertEquals("test=1", s);
6
            assertEquals(
7
            man.addCookieFromHeader("test=2", url);
7
3,man.getCookieCount());
8
            s = man.getCookieHeaderForURL(url);
8
            String s = man.getCookieHeaderForURL(url);
9
            assertNotNull(s);
9
            assertNotNull(s);
10
            assertEquals("test=2", s);
10
            assertEquals("test2=moo2; test1=moo1; test2=moo3", s);
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 comparisons57
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    URL url = new URL("http://a.b.c/");
    1
    URL url = new URL("http://a.b.c/");
    1
    URL url = new URL("http://order.now/sub1/moo.html");
    Differences
    Expression1Expression2Difference
    "http://a.b.c/""http://order.now/sub1/moo.html"LITERAL_VALUE_MISMATCH
    1
    URL url = new URL("http://order.now/sub1/moo.html");
    2
    man.addCookieFromHeader("test=1", url);
    2
    man.addCookieFromHeader("test=1", url);
    2
    man.addCookieFromHeader("test1=moo1;path=/", url);
    Differences
    Expression1Expression2Difference
    "test=1""test1=moo1;path=/"LITERAL_VALUE_MISMATCH
    2
    man.addCookieFromHeader("test1=moo1;path=/", url);
    3
    String s = man.getCookieHeaderForURL(url);
    6
    String s = man.getCookieHeaderForURL(url);
    4
    assertNotNull(s);
    4
    assertNotNull(s);
    4
    man.addCookieFromHeader("test2=moo3;path=/", url);
    Differences
    Expression1Expression2Difference
    assertNotNulladdCookieFromHeaderMETHOD_INVOCATION_NAME_MISMATCH
    assertNotNull(s)man.addCookieFromHeader("test2=moo3;path=/",url)ARGUMENT_NUMBER_MISMATCH
    manMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression assertNotNull(s) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression man.addCookieFromHeader("test2=moo3;path=/",url) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertNotNull(s) is a void method call, and thus it cannot be parameterized
    Expression man.addCookieFromHeader("test2=moo3;path=/",url) is a void method call, and thus it cannot be parameterized
    Expression assertNotNull(s) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression man.addCookieFromHeader("test2=moo3;path=/",url) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertNotNull(s) is a void method call, and thus it cannot be parameterized
    Expression man.addCookieFromHeader("test2=moo3;path=/",url) is a void method call, and thus it cannot be parameterized
    4
    man.addCookieFromHeader("test2=moo3;path=/", url);
    5
    assertEquals("test=1", s);
    5
    assertEquals("test=1", s);
    8
    assertEquals("test2=moo2; test1=moo1; test2=moo3", s);
    Differences
    Expression1Expression2Difference
    "test=1""test2=moo2; test1=moo1; test2=moo3"LITERAL_VALUE_MISMATCH
    8
    assertEquals("test2=moo2; test1=moo1; test2=moo3", s);
    6
    man.addCookieFromHeader("test=2", url);
    6
    man.addCookieFromHeader("test=2", url);
    3
    man.addCookieFromHeader("test2=moo2;path=/sub1", url);
    Differences
    Expression1Expression2Difference
    "test=2""test2=moo2;path=/sub1"LITERAL_VALUE_MISMATCH
    3
    man.addCookieFromHeader("test2=moo2;path=/sub1", url);
    7
    s = man.getCookieHeaderForURL(url);
    7
    s = man.getCookieHeaderForURL(url);
    Preondition Violations
    Unmatched statement s=man.getCookieHeaderForURL(url); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                            
    8
    assertNotNull(s);
    8
    assertNotNull(s);
    5
    assertEquals(3, man.getCookieCount());
    Differences
    Expression1Expression2Difference
    assertNotNullassertEqualsMETHOD_INVOCATION_NAME_MISMATCH
    assertNotNull(s)assertEquals(3,man.getCookieCount())ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression assertNotNull(s) is a void method call, and thus it cannot be parameterized
    Expression assertEquals(3,man.getCookieCount()) is a void method call, and thus it cannot be parameterized
    Expression assertNotNull(s) is a void method call, and thus it cannot be parameterized
    Expression assertEquals(3,man.getCookieCount()) is a void method call, and thus it cannot be parameterized
    5
    assertEquals(3, man.getCookieCount());
    9
    assertEquals("test=2", s);
    9
    assertEquals("test=2", s);
    7
    assertNotNull(s);
    Differences
    Expression1Expression2Difference
    assertEqualsassertNotNullMETHOD_INVOCATION_NAME_MISMATCH
    assertEquals("test=2",s)assertNotNull(s)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression assertNotNull(s) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertEquals("test=2",s) is a void method call, and thus it cannot be parameterized
    Expression assertNotNull(s) is a void method call, and thus it cannot be parameterized
    Expression assertNotNull(s) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertEquals("test=2",s) is a void method call, and thus it cannot be parameterized
    Expression assertNotNull(s) is a void method call, and thus it cannot be parameterized
    7
    assertNotNull(s);
    Precondition Violations (20)
    Row Violation
    1Expression assertNotNull(s) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression man.addCookieFromHeader("test2=moo3;path=/",url) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression assertNotNull(s) is a void method call, and thus it cannot be parameterized
    4Expression man.addCookieFromHeader("test2=moo3;path=/",url) is a void method call, and thus it cannot be parameterized
    5Expression assertNotNull(s) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression man.addCookieFromHeader("test2=moo3;path=/",url) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression assertNotNull(s) is a void method call, and thus it cannot be parameterized
    8Expression man.addCookieFromHeader("test2=moo3;path=/",url) is a void method call, and thus it cannot be parameterized
    9Unmatched statement s=man.getCookieHeaderForURL(url); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10Expression assertNotNull(s) is a void method call, and thus it cannot be parameterized
    11Expression assertEquals(3,man.getCookieCount()) is a void method call, and thus it cannot be parameterized
    12Expression assertNotNull(s) is a void method call, and thus it cannot be parameterized
    13Expression assertEquals(3,man.getCookieCount()) is a void method call, and thus it cannot be parameterized
    14Expression assertNotNull(s) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    15Expression assertEquals("test=2",s) is a void method call, and thus it cannot be parameterized
    16Expression assertNotNull(s) is a void method call, and thus it cannot be parameterized
    17Expression assertNotNull(s) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    18Expression assertEquals("test=2",s) is a void method call, and thus it cannot be parameterized
    19Expression assertNotNull(s) is a void method call, and thus it cannot be parameterized
    20Clone fragment #1 returns variables url, s , while Clone fragment #2 returns variables