FileRowColContainer f = new FileRowColContainer("testfiles/test.csv");
assertNotNull(f);
assertTrue("Not empty", f.getSize() > 0);
int myRow = f.nextRow();
assertEquals(0, myRow);
assertEquals("a1", f.getColumn(myRow, 0));
assertEquals("d1", f.getColumn(myRow, 3));
try {
f.getColumn(myRow, 4);
fail("Expected out of bounds");
} catch (IndexOutOfBoundsException e) {
}
myRow = f.nextRow();
assertEquals(1, myRow);
assertEquals("b2", f.getColumn(myRow, 1));
assertEquals("c2", f.getColumn(myRow, 2));
FileRowColContainer f = new FileRowColContainer("testfiles/test.tsv", "\t");
assertNotNull(f);
assertTrue("Not empty", f.getSize() > 0);
int myRow = f.nextRow();
assertEquals(0, myRow);
assertEquals("a1", f.getColumn(myRow, 0));
assertEquals("d1", f.getColumn(myRow, 3));
try {
f.getColumn(myRow, 4);
fail("Expected out of bounds");
} catch (IndexOutOfBoundsException e) {
}
myRow = f.nextRow();
assertEquals(1, myRow);
assertEquals("b2", f.getColumn(myRow, 1));
assertEquals("c2", f.getColumn(myRow, 2));
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/functions/TestFileRowColContainer.java
|
|
File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/functions/TestFileRowColContainer.java
|
Method name: void testColumns()
|
|
Method name: void testColumnsTab()
|
Number of AST nodes: 14
|
|
Number of AST nodes: 14
|
|
1 | FileRowColContainer f = new FileRowColContainer("testfiles/test.csv");↵ | | 1 | FileRowColContainer f = new FileRowColContainer("testfiles/test.tsv", "\t");↵
|
2 | assertNotNull(f);↵ | | 2 | assertNotNull(f);↵
|
3 | assertTrue("Not empty", f.getSize() > 0);↵ | | 3 | assertTrue("Not empty", f.getSize() > 0);↵
|
|
4 | int myRow = f.nextRow();↵ | | 4 | int myRow = f.nextRow();↵
|
5 | assertEquals(0, myRow);↵ | | 5 | assertEquals(0, myRow);↵
|
6 | assertEquals("a1", f.getColumn(myRow, 0));↵ | | 6 | assertEquals("a1", f.getColumn(myRow, 0));↵
|
7 | assertEquals("d1", f.getColumn(myRow, 3));↵ | | 7 | assertEquals("d1", f.getColumn(myRow, 3));↵
|
|
8 | try {↵ | | 8 | try {↵
|
9 | f.getColumn(myRow, 4);↵ | | 9 | f.getColumn(myRow, 4);↵
|
10 | fail("Expected out of bounds");↵ | | 10 | fail("Expected out of bounds");↵
|
11 | } catch (IndexOutOfBoundsException e) {↵ | | 11 | } catch (IndexOutOfBoundsException e) {↵
|
12 | }↵ | | 12 | }↵
|
13 | myRow = f.nextRow();↵ | | 13 | myRow = f.nextRow();↵
|
14 | assertEquals(1, myRow);↵ | | 14 | assertEquals(1, myRow);↵
|
15 | assertEquals("b2", f.getColumn(myRow, 1));↵ | | 15 | assertEquals("b2", f.getColumn(myRow, 1));↵
|
16 | assertEquals("c2", f.getColumn(myRow, 2)); | | 16 | assertEquals("c2", f.getColumn(myRow, 2));
|
See real code fragment |
|
See real code fragment |
Summary
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.1 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 82 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 14 |
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) | 6.7 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | FileRowColContainer f = new FileRowColContainer("testfiles/test.csv"); | | 1 | FileRowColContainer f = new FileRowColContainer("testfiles/test.tsv", "\t"); |
2 | assertNotNull(f); | | 2 | assertNotNull(f); |
3 | assertTrue("Not empty", f.getSize() > 0); | | 3 | assertTrue("Not empty", f.getSize() > 0); |
4 | int myRow = f.nextRow(); | | 4 | int myRow = f.nextRow(); |
5 | assertEquals(0, myRow); | | 5 | assertEquals(0, myRow); |
6 | assertEquals("a1", f.getColumn(myRow, 0)); | | 6 | assertEquals("a1", f.getColumn(myRow, 0)); |
7 | assertEquals("d1", f.getColumn(myRow, 3)); | | 7 | assertEquals("d1", f.getColumn(myRow, 3)); |
8 | try | | 8 | try |
9 | | | 9 | |
10 | fail("Expected out of bounds"); | | 10 | fail("Expected out of bounds"); |
11 | myRow = f.nextRow(); | | 11 | myRow = f.nextRow(); |
12 | assertEquals(1, myRow); | | 12 | assertEquals(1, myRow); |
13 | assertEquals("b2", f.getColumn(myRow, 1)); | | 13 | assertEquals("b2", f.getColumn(myRow, 1)); |
14 | assertEquals("c2", f.getColumn(myRow, 2)); | | 14 | assertEquals("c2", f.getColumn(myRow, 2)); |
Precondition Violations (0)
Row |
Violation |