File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/mail/MailMessageTest.java | File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/mail/MailMessageTest.java | |||
Method name: void testToOnly()
|
Method name: void testNoSubject()
|
|||
Number of AST nodes: 10 | Number of AST nodes: 10 | |||
1 | testMailClient.to("to@you.com");↵ | 1 | testMailClient.from("Mail Message <EmailTaskTest@ant.apache.org>");↵ | |
2 | testMailClient.setSubject("Test subject");↵ | 2 | testMailClient.to("to@you.com");↵ | |
3 | testMailClient.setMessage( "test line 1\n" +↵ | 3 | testMailClient.setMessage( "test line 1\n" +↵ | |
4 | "test line 2" );↵ | 4 | "test line 2" );↵ | |
5 | Thread client = new Thread(testMailClient);↵ | 5 | Thread client = new Thread(testMailClient);↵ | |
6 | client.start();↵ | 6 | client.start();↵ | |
7 | try {↵ | 7 | try {↵ | |
8 | server.join(60 * 1000); // 60s↵ | 8 | server.join(60 * 1000); // 60s↵ | |
9 | client.join(30 * 1000); // a further 30s↵ | 9 | client.join(30 * 1000); // a further 30s↵ | |
10 | } catch (InterruptedException ie ) {↵ | 10 | } catch (InterruptedException ie ) {↵ | |
11 | fail("InterruptedException: " + ie);↵ | 11 | fail( "InterruptedException: " + ie );↵ | |
12 | }↵ | 12 | }↵ | |
13 | String result = testMailServer.getResult();↵ | 13 | String result = testMailServer.getResult();↵ | |
14 | String expectedResult = "220 test SMTP EmailTaskTest\r\n" +↵ | 14 | String expectedResult = "220 test SMTP EmailTaskTest\r\n" +↵ | |
15 | "HELO " + local + "\r\n" +↵ | 15 | "HELO " + local + "\r\n" +↵ | |
16 | "250 " + local + " Hello " + local + " [127.0.0.1], pleased to meet you\r\n" +↵ | 16 | "250 " + local + " Hello " + local + " [127.0.0.1], pleased to meet you\r\n" +↵ | |
17 | "MAIL FROM: <EmailTaskTest@ant.apache.org>\r\n" +↵ | 17 | "MAIL FROM: <EmailTaskTest@ant.apache.org>\r\n" +↵ | |
18 | "250\r\n" +↵ | 18 | "250\r\n" +↵ | |
19 | "RCPT TO: <to@you.com>\r\n" +↵ | 19 | "RCPT TO: <to@you.com>\r\n" +↵ | |
20 | "250\r\n" +↵ | 20 | "250\r\n" +↵ | |
21 | "DATA\r\n" +↵ | 21 | "DATA\r\n" +↵ | |
22 | "354\r\n" +↵ | 22 | "354\r\n" +↵ | |
23 | "Subject: Test subject\r\n" +↵ | |||
24 | "From: Mail Message <EmailTaskTest@ant.apache.org>\r\n" +↵ | 23 | "From: Mail Message <EmailTaskTest@ant.apache.org>\r\n" +↵ | |
25 | "To: to@you.com\r\n" +↵ | 24 | "To: to@you.com\r\n" +↵ | |
26 | "X-Mailer: org.apache.tools.mail.MailMessage (ant.apache.org)\r\n" +↵ | 25 | "X-Mailer: org.apache.tools.mail.MailMessage (ant.apache.org)\r\n" +↵ | |
27 | "\r\n" +↵ | 26 | "\r\n" +↵ | |
28 | "test line 1\r\n" +↵ | 27 | "test line 1\r\n" +↵ | |
29 | "test line 2\r\n" +↵ | 28 | "test line 2\r\n" +↵ | |
30 | "\r\n" +↵ | 29 | "\r\n" +↵ | |
31 | ".\r\n" +↵ | 30 | ".\r\n" +↵ | |
32 | "250\r\n" +↵ | 31 | "250\r\n" +↵ | |
33 | "QUIT\r\n" +↵ | 32 | "QUIT\r\n" +↵ | |
34 | "221\r\n"; | 33 |
| |
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.2 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 38 |
Number of mapped statements | 10 |
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) | 3.9 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6 | testMailClient.to("to@you.com"); | 6 | testMailClient.to("to@you.com"); | ||||||||||||||||||
7 | testMailClient.setSubject("Test subject"); |
| 5 | testMailClient.from("Mail Message <EmailTaskTest@ant.apache.org>"); | |||||||||||||||||
8 | testMailClient.setMessage("test line 1\n" + "test line 2"); | 7 | testMailClient.setMessage("test line 1\n" + "test line 2"); | ||||||||||||||||||
9 | Thread client = new Thread(testMailClient); | 8 | Thread client = new Thread(testMailClient); | ||||||||||||||||||
10 | client.start(); | 9 | client.start(); | ||||||||||||||||||
11 | try | 10 | try | ||||||||||||||||||
12 | server.join(60 * 1000); | 11 | server.join(60 * 1000); | ||||||||||||||||||
13 | client.join(30 * 1000); | 12 | client.join(30 * 1000); | ||||||||||||||||||
14 | String result = testMailServer.getResult(); | 13 | String result = testMailServer.getResult(); | ||||||||||||||||||
15 | String expectedResult = "220 test SMTP EmailTaskTest\r\n" + "HELO " + local + "\r\n" + "250 " + local + " Hello " + local + " [127.0.0.1], pleased to meet you\r\n" + "MAIL FROM: <EmailTaskTest@ant.apache.org>\r\n" + "250\r\n" + "RCPT TO: <to@you.com>\r\n" + "250\r\n" + "DATA\r\n" + "354\r\n" + "Subject: Test subject\r\n" + "From: Mail Message <EmailTaskTest@ant.apache.org>\r\n" + "To: to@you.com\r\n" + "X-Mailer: org.apache.tools.mail.MailMessage (ant.apache.org)\r\n" + "\r\n" + "test line 1\r\n" + "test line 2\r\n" + "\r\n" + ".\r\n" + "250\r\n" + "QUIT\r\n" + "221\r\n"; |
| 14 | String expectedResult = "220 test SMTP EmailTaskTest\r\n" + "HELO " + local + "\r\n" + "250 " + local + " Hello " + local + " [127.0.0.1], pleased to meet you\r\n" + "MAIL FROM: <EmailTaskTest@ant.apache.org>\r\n" + "250\r\n" + "RCPT TO: <to@you.com>\r\n" + "250\r\n" + "DATA\r\n" + "354\r\n" + "From: Mail Message <EmailTaskTest@ant.apache.org>\r\n" + "To: to@you.com\r\n" + "X-Mailer: org.apache.tools.mail.MailMessage (ant.apache.org)\r\n" + "\r\n" + "test line 1\r\n" + "test line 2\r\n" + "\r\n" + ".\r\n" + "250\r\n" + "QUIT\r\n" + "221\r\n"; |
Row | Violation |
---|---|
1 | Expression testMailClient.setSubject("Test subject") cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression testMailClient.from("Mail Message <EmailTaskTest@ant.apache.org>") cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression testMailClient.setSubject("Test subject") is a void method call, and thus it cannot be parameterized |
4 | Expression testMailClient.from("Mail Message <EmailTaskTest@ant.apache.org>") is a void method call, and thus it cannot be parameterized |
5 | Clone fragment #1 returns variables result, expectedResult , while Clone fragment #2 returns variables result, expectedResult |