URL url = new URL("http://a.b.c/"); man.addCookieFromHeader("NSCP_USER_LOGIN1_NEW=SHA=xxxxx", url); String s = man.getCookieHeaderForURL(url); assertNotNull(s); assertEquals("NSCP_USER_LOGIN1_NEW=SHA=xxxxx", s); Cookie c=man.get(0); assertEquals("NSCP_USER_LOGIN1_NEW",c.getName()); assertEquals("SHA=xxxxx",c.getValue());
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 testCookieWithEquals() Method name: void testCookieOrdering1()
Number of AST nodes: 8 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("NSCP_USER_LOGIN1_NEW=SHA=xxxxx", url);
2
            man.addCookieFromHeader("test1=moo1;path=/", url);
3
            String s = man.getCookieHeaderForURL(url);
3
            man.addCookieFromHeader
4
            assertNotNull(s);
5
            assertEquals("NSCP_USER_LOGIN1_NEW=SHA=xxxxx", s);
6
            Cookie c=man.get(0);
7
            assertEquals("NSCP_USER_LOGIN1_NEW",c.getName());
8
            assertEquals("SHA=xxxxx",c.getValue()
4
("test2=moo2;path=/sub1", url);
5
            man.addCookieFromHeader("test2=moo3;path=/", url);
6
            assertEquals(3,man.getCookieCount());
7
            String s = man.getCookieHeaderForURL(url);
8
            assertNotNull(s);
9
);
9
            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 comparisons50
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    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("NSCP_USER_LOGIN1_NEW=SHA=xxxxx", url);
    2
    man.addCookieFromHeader("NSCP_USER_LOGIN1_NEW=SHA=xxxxx", url);
    2
    man.addCookieFromHeader("test1=moo1;path=/", url);
    Differences
    Expression1Expression2Difference
    "NSCP_USER_LOGIN1_NEW=SHA=xxxxx""test1=moo1;path=/"LITERAL_VALUE_MISMATCH
    2
    man.addCookieFromHeader("test1=moo1;path=/", url);
                                                                                                                    
    3
    man.addCookieFromHeader("test2=moo2;path=/sub1", url);
                                                                                                            
    4
    man.addCookieFromHeader("test2=moo3;path=/", url);
                                                                                    
    5
    assertEquals(3, man.getCookieCount());
    3
    String s = man.getCookieHeaderForURL(url);
    6
    String s = man.getCookieHeaderForURL(url);
    4
    assertNotNull(s);
    7
    assertNotNull(s);
    5
    assertEquals("NSCP_USER_LOGIN1_NEW=SHA=xxxxx", s);
    5
    assertEquals("NSCP_USER_LOGIN1_NEW=SHA=xxxxx", s);
    8
    assertEquals("test2=moo2; test1=moo1; test2=moo3", s);
    Differences
    Expression1Expression2Difference
    "NSCP_USER_LOGIN1_NEW=SHA=xxxxx""test2=moo2; test1=moo1; test2=moo3"LITERAL_VALUE_MISMATCH
    8
    assertEquals("test2=moo2; test1=moo1; test2=moo3", s);
    6
    Cookie c = man.get(0);
                                                  
    7
    assertEquals("NSCP_USER_LOGIN1_NEW", c.getName());
                                                                                                            
    8
    assertEquals("SHA=xxxxx", c.getValue());
                                                                                        
    Precondition Violations (1)
    Row Violation
    1Clone fragment #1 returns variables , while Clone fragment #2 returns variables url