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 testBccOnly()
|
|||
Number of AST nodes: 13 | Number of AST nodes: 13 | |||
1 | testMailClient.setSubject("Test subject");↵ | 1 | testMailClient.setSubject("Test subject");↵ | |
2 | testMailClient.setMessage( "test line 1\n" +↵ | 2 | testMailClient.setMessage( "test line 1\n" +↵ | |
3 | "test line 2" );↵ | 3 | "test line 2" );↵ | |
4 | Thread client = new Thread(testMailClient);↵ | 4 | Thread client = new Thread(testMailClient);↵ | |
5 | client.start();↵ | 5 | client.start();↵ | |
6 | try {↵ | 6 | try {↵ | |
7 | server.join(60 * 1000); // 60s↵ | 7 | server.join(60 * 1000); // 60s↵ | |
8 | client.join(30 * 1000); // a further 30s↵ | 8 | client.join(30 * 1000); // a further 30s↵ | |
9 | } catch (InterruptedException ie ) {↵ | 9 | } catch (InterruptedException ie ) {↵ | |
10 | fail("InterruptedException: " + ie);↵ | 10 | fail( "InterruptedException: " + ie );↵ | |
11 | }↵ | 11 | }↵ | |
12 | String result = testMailServer.getResult();↵ | 12 | String result = testMailServer.getResult();↵ | |
13 | String expectedResult = "220 test SMTP EmailTaskTest\r\n" +↵ | 13 | String expectedResult = "220 test SMTP EmailTaskTest\r\n" +↵ | |
14 | "HELO " + local + "\r\n" +↵ | 14 | "HELO " + local + "\r\n" +↵ | |
15 | "250 " + local + " Hello " + local + " [127.0.0.1], pleased to meet you\r\n" +↵ | 15 | "250 " + local + " Hello " + local + " [127.0.0.1], pleased to meet you\r\n" +↵ | |
16 | "MAIL FROM: <EmailTaskTest@ant.apache.org>\r\n" +↵ | 16 | "MAIL FROM: <EmailTaskTest@ant.apache.org>\r\n" +↵ | |
17 | "250\r\n" +↵ | 17 | "250\r\n" +↵ | |
18 | "RCPT TO: <to@you.com>\r\n" +↵ | 18 | "RCPT TO: <bcc@you.com>\r\n" +↵ | |
19 | "250\r\n" +↵ | 19 | "250\r\n" +↵ | |
20 | "DATA\r\n" +↵ | 20 | "DATA\r\n" +↵ | |
21 | "354\r\n" +↵ | 21 | "354\r\n" +↵ | |
22 | "Subject: Test subject\r\n" +↵ | 22 | "Subject: Test subject\r\n" +↵ | |
23 | "From: Mail Message <EmailTaskTest@ant.apache.org>\r\n" +↵ | 23 | "From: Mail Message <EmailTaskTest@ant.apache.org>\r\n" +↵ | |
24 | "To: to@you.com\r\n" +↵ | |||
25 | "X-Mailer: org.apache.tools.mail.MailMessage (ant.apache.org)\r\n" +↵ | 24 | "X-Mailer: org.apache.tools.mail.MailMessage (ant.apache.org)\r\n" +↵ | |
26 | "\r\n" +↵ | 25 | "\r\n" +↵ | |
27 | "test line 1\r\n" +↵ | 26 | "test line 1\r\n" +↵ | |
28 | "test line 2\r\n" +↵ | 27 | "test line 2\r\n" +↵ | |
29 | "\r\n" +↵ | 28 | "\r\n" +↵ | |
30 | ".\r\n" +↵ | 29 | ".\r\n" +↵ | |
31 | "250\r\n" +↵ | 30 | "250\r\n" +↵ | |
32 | "QUIT\r\n" +↵ | 31 | "QUIT\r\n" +↵ | |
33 | "221\r\n";↵ | 32 | "221\r\n";↵ | |
34 | assertEquals(expectedResult.length(), result.length());↵ | 33 | assertEquals( expectedResult.length(), result.length() );↵ | |
35 | assertEquals(expectedResult, result); // order of headers cannot be guaranteed↵ | 34 | assertEquals( expectedResult, result );↵ | |
36 | if (testMailClient.isFailed()) {↵ | 35 | if ( testMailClient.isFailed() ) {↵ | |
37 | fail(testMailClient.getFailMessage());↵ | 36 | fail( testMailClient.getFailMessage() );↵ | |
38 | } | 37 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
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 | 55 |
Number of mapped statements | 13 |
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) | 4.3 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7 | testMailClient.setSubject("Test subject"); | 7 | testMailClient.setSubject("Test subject"); | |||||||||||
8 | testMailClient.setMessage("test line 1\n" + "test line 2"); | 8 | testMailClient.setMessage("test line 1\n" + "test line 2"); | |||||||||||
9 | Thread client = new Thread(testMailClient); | 9 | Thread client = new Thread(testMailClient); | |||||||||||
10 | client.start(); | 10 | client.start(); | |||||||||||
11 | try | 11 | try | |||||||||||
12 | server.join(60 * 1000); | 12 | server.join(60 * 1000); | |||||||||||
13 | client.join(30 * 1000); | 13 | client.join(30 * 1000); | |||||||||||
14 | String result = testMailServer.getResult(); | 14 | 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"; |
| 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: <bcc@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" + "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"; | ||||||||||
16 | assertEquals(expectedResult.length(), result.length()); | 16 | assertEquals(expectedResult.length(), result.length()); | |||||||||||
17 | assertEquals(expectedResult, result); | 17 | assertEquals(expectedResult, result); | |||||||||||
18 | if (testMailClient.isFailed()) | 18 | if (testMailClient.isFailed()) | |||||||||||
19 | fail(testMailClient.getFailMessage()); | 19 | fail(testMailClient.getFailMessage()); |
Row | Violation |
---|