File path: /columba-1.4-src/mail/src/test/java/org/columba/mail/config/AccountItemTest.java | File path: /columba-1.4-src/mail/src/test/java/org/columba/mail/config/AccountItemTest.java | |||
Method name: void testHashCode()
|
Method name: void testEqualsObject()
|
|||
Number of AST nodes: 40 | Number of AST nodes: 40 | |||
1 | XmlElement xml = new XmlElement("account");↵ | 1 | XmlElement xml = new XmlElement("account");↵ | |
2 | xml.addAttribute("name", "my account");↵ | 2 | xml.addAttribute("name", "my account");↵ | |
3 | xml.addAttribute("uid", "0");↵ | 3 | xml.addAttribute("uid", "0");↵ | |
4 | XmlElement child = xml.addSubElement("identity");↵ | 4 | XmlElement child = xml.addSubElement("identity");↵ | |
5 | child.addAttribute("name", "John Doe");↵ | 5 | child.addAttribute("name", "John Doe");↵ | |
6 | child.addAttribute("attach_signature", "false");↵ | 6 | child.addAttribute("attach_signature", "false");↵ | |
7 | child = xml.addSubElement("popserver");↵ | 7 | child = xml.addSubElement("popserver");↵ | |
8 | child.addAttribute("port", "25");↵ | 8 | child.addAttribute("port", "25");↵ | |
9 | child.addAttribute("login_method", "USER");↵ | 9 | child.addAttribute("login_method", "USER");↵ | |
10 | child = xml.addSubElement("specialfolders");↵ | 10 | child = xml.addSubElement("specialfolders");↵ | |
11 | child.addAttribute("inbox", "101");↵ | 11 | child.addAttribute("inbox", "101");↵ | |
12 | child.addAttribute("sent", "104");↵ | 12 | child.addAttribute("sent", "104");↵ | |
13 | AccountItem item = new AccountItem(xml);↵ | 13 | AccountItem item = new AccountItem(xml);↵ | |
14 | // second account item↵ | 14 | // second account item↵ | |
15 | XmlElement xml2 = new XmlElement("account");↵ | 15 | XmlElement xml2 = new XmlElement("account");↵ | |
16 | xml2.addAttribute("uid", "0");↵ | 16 | xml2.addAttribute("uid", "0");↵ | |
17 | xml2.addAttribute("name", "my account");↵ | 17 | xml2.addAttribute("name", "my account");↵ | |
18 | XmlElement child2 = xml2.addSubElement("identity");↵ | 18 | XmlElement child2 = xml2.addSubElement("identity");↵ | |
19 | child2.addAttribute("attach_signature", "false");↵ | 19 | child2.addAttribute("attach_signature", "false");↵ | |
20 | child2.addAttribute("name", "John Doe");↵ | 20 | child2.addAttribute("name", "John Doe");↵ | |
21 | child2 = xml2.addSubElement("popserver");↵ | 21 | child2 = xml2.addSubElement("popserver");↵ | |
22 | child2.addAttribute("login_method", "USER");↵ | 22 | child2.addAttribute("login_method", "USER");↵ | |
23 | child2.addAttribute("port", "25");↵ | 23 | child2.addAttribute("port", "25");↵ | |
24 | child2 = xml2.addSubElement("specialfolders");↵ | 24 | child2 = xml2.addSubElement("specialfolders");↵ | |
25 | child2.addAttribute("sent", "104");↵ | 25 | child2.addAttribute("sent", "104");↵ | |
26 | child2.addAttribute("inbox", "101");↵ | 26 | child2.addAttribute("inbox", "101");↵ | |
27 | AccountItem item2 = new AccountItem(xml2);↵ | 27 | AccountItem item2 = new AccountItem(xml2);↵ | |
28 | // third item, a bit different from the first↵ | 28 | // third item, a bit different from the first↵ | |
29 | XmlElement xml3 = new XmlElement("account");↵ | 29 | XmlElement xml3 = new XmlElement("account");↵ | |
30 | xml3.addAttribute("name", "my account");↵ | 30 | xml3.addAttribute("name", "my account");↵ | |
31 | xml3.addAttribute("uid", "0");↵ | 31 | xml3.addAttribute("uid", "0");↵ | |
32 | XmlElement child3 = xml3.addSubElement("identity");↵ | 32 | XmlElement child3 = xml3.addSubElement("identity");↵ | |
33 | child3.addAttribute("name", "Kalle Kamel");↵ | 33 | child3.addAttribute("name", "Kalle Kamel");↵ | |
34 | child3.addAttribute("attach_signature", "false");↵ | 34 | child3.addAttribute("attach_signature", "false");↵ | |
35 | child3 = xml3.addSubElement("popserver");↵ | 35 | child3 = xml3.addSubElement("popserver");↵ | |
36 | child3.addAttribute("port", "25");↵ | 36 | child3.addAttribute("port", "25");↵ | |
37 | child3.addAttribute("login_method", "USER");↵ | 37 | child3.addAttribute("login_method", "USER");↵ | |
38 | child3 = xml3.addSubElement("specialfolders");↵ | 38 | child3 = xml3.addSubElement("specialfolders");↵ | |
39 | child3.addAttribute("inbox", "101");↵ | 39 | child3.addAttribute("inbox", "101");↵ | |
40 | child3.addAttribute("sent", "104");↵ | 40 | child3.addAttribute("sent", "104");↵ | |
41 | AccountItem item3 = new AccountItem(xml3);↵ | 41 | AccountItem item3 = new AccountItem(xml3);↵ | |
42 | // should have the same hashcodes...↵ | 42 | // ↵ | |
43 | assertTrue("The hashcodes of item and item2 are not the same",↵ | |||
44 | item.hashCode() == item2.hashCode(↵ | 43 | test self equality...↵ | |
45 | )); | 44 | assertTrue("Self equality failed for item", item.equals(item)); | |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.0 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 632 |
Number of mapped statements | 40 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | XmlElement xml = new XmlElement("account"); | 1 | XmlElement xml = new XmlElement("account"); | ||||||||||||||||
2 | xml.addAttribute("name", "my account"); | 2 | xml.addAttribute("name", "my account"); | ||||||||||||||||
3 | xml.addAttribute("uid", "0"); | 3 | xml.addAttribute("uid", "0"); | ||||||||||||||||
4 | XmlElement child = xml.addSubElement("identity"); | 4 | XmlElement child = xml.addSubElement("identity"); | ||||||||||||||||
5 | child.addAttribute("name", "John Doe"); | 5 | child.addAttribute("name", "John Doe"); | ||||||||||||||||
6 | child.addAttribute("attach_signature", "false"); | 6 | child.addAttribute("attach_signature", "false"); | ||||||||||||||||
7 | child = xml.addSubElement("popserver"); | 7 | child = xml.addSubElement("popserver"); | ||||||||||||||||
8 | child.addAttribute("port", "25"); | 8 | child.addAttribute("port", "25"); | ||||||||||||||||
9 | child.addAttribute("login_method", "USER"); | 9 | child.addAttribute("login_method", "USER"); | ||||||||||||||||
10 | child = xml.addSubElement("specialfolders"); | 10 | child = xml.addSubElement("specialfolders"); | ||||||||||||||||
11 | child.addAttribute("inbox", "101"); | 11 | child.addAttribute("inbox", "101"); | ||||||||||||||||
12 | child.addAttribute("sent", "104"); | 12 | child.addAttribute("sent", "104"); | ||||||||||||||||
13 | AccountItem item = new AccountItem(xml); | 13 | AccountItem item = new AccountItem(xml); | ||||||||||||||||
14 | XmlElement xml2 = new XmlElement("account"); | 14 | XmlElement xml2 = new XmlElement("account"); | ||||||||||||||||
15 | xml2.addAttribute("uid", "0"); | 15 | xml2.addAttribute("uid", "0"); | ||||||||||||||||
16 | xml2.addAttribute("name", "my account"); | 16 | xml2.addAttribute("name", "my account"); | ||||||||||||||||
17 | XmlElement child2 = xml2.addSubElement("identity"); | 17 | XmlElement child2 = xml2.addSubElement("identity"); | ||||||||||||||||
18 | child2.addAttribute("attach_signature", "false"); | 18 | child2.addAttribute("attach_signature", "false"); | ||||||||||||||||
19 | child2.addAttribute("name", "John Doe"); | 19 | child2.addAttribute("name", "John Doe"); | ||||||||||||||||
20 | child2 = xml2.addSubElement("popserver"); | 20 | child2 = xml2.addSubElement("popserver"); | ||||||||||||||||
21 | child2.addAttribute("login_method", "USER"); | 21 | child2.addAttribute("login_method", "USER"); | ||||||||||||||||
22 | child2.addAttribute("port", "25"); | 22 | child2.addAttribute("port", "25"); | ||||||||||||||||
23 | child2 = xml2.addSubElement("specialfolders"); | 23 | child2 = xml2.addSubElement("specialfolders"); | ||||||||||||||||
24 | child2.addAttribute("sent", "104"); | 24 | child2.addAttribute("sent", "104"); | ||||||||||||||||
25 | child2.addAttribute("inbox", "101"); | 25 | child2.addAttribute("inbox", "101"); | ||||||||||||||||
26 | AccountItem item2 = new AccountItem(xml2); | 26 | AccountItem item2 = new AccountItem(xml2); | ||||||||||||||||
27 | XmlElement xml3 = new XmlElement("account"); | 27 | XmlElement xml3 = new XmlElement("account"); | ||||||||||||||||
28 | xml3.addAttribute("name", "my account"); | 28 | xml3.addAttribute("name", "my account"); | ||||||||||||||||
29 | xml3.addAttribute("uid", "0"); | 29 | xml3.addAttribute("uid", "0"); | ||||||||||||||||
30 | XmlElement child3 = xml3.addSubElement("identity"); | 30 | XmlElement child3 = xml3.addSubElement("identity"); | ||||||||||||||||
31 | child3.addAttribute("name", "Kalle Kamel"); | 31 | child3.addAttribute("name", "Kalle Kamel"); | ||||||||||||||||
32 | child3.addAttribute("attach_signature", "false"); | 32 | child3.addAttribute("attach_signature", "false"); | ||||||||||||||||
33 | child3 = xml3.addSubElement("popserver"); | 33 | child3 = xml3.addSubElement("popserver"); | ||||||||||||||||
34 | child3.addAttribute("port", "25"); | 34 | child3.addAttribute("port", "25"); | ||||||||||||||||
35 | child3.addAttribute("login_method", "USER"); | 35 | child3.addAttribute("login_method", "USER"); | ||||||||||||||||
36 | child3 = xml3.addSubElement("specialfolders"); | 36 | child3 = xml3.addSubElement("specialfolders"); | ||||||||||||||||
37 | child3.addAttribute("inbox", "101"); | 37 | child3.addAttribute("inbox", "101"); | ||||||||||||||||
38 | child3.addAttribute("sent", "104"); | 38 | child3.addAttribute("sent", "104"); | ||||||||||||||||
39 | AccountItem item3 = new AccountItem(xml3); | 39 | AccountItem item3 = new AccountItem(xml3); | ||||||||||||||||
40 | assertTrue("The hashcodes of item and item2 are not the same", item.hashCode() == item2.hashCode()); |
| 40 | assertTrue("Self equality failed for item", item.equals(item)); |
Row | Violation |
---|---|
1 | Expression item.hashCode() == item2.hashCode() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression item.equals(item) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Clone fragment #1 returns variables item, item3 , while Clone fragment #2 returns variables item2, item, item3 |