added unit test to demostrate bug #1564465 (test is disabled until the problem is fixed, so that gump won't break)

This commit is contained in:
Lars Kühne 2006-09-24 11:37:55 +00:00
parent 6cbcc2f1ee
commit a1068badba
2 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,30 @@
// A class that has overlapping areas of duplication (min=3)
public class Overlapping {
public m1() {
int a = 0;
int b = 0;
int c = 0;
int d = 0;
}
public m2() {
int a = 0;
int b = 0;
int c = 0;
}
public m3() {
int b = 0;
int c = 0;
int d = 0;
}
public m4() {
int a = 0;
int b = 0;
int c = 0;
int d = 0;
}
}

View File

@ -47,4 +47,21 @@ public class StrictDuplicateCodeCheckTest extends BaseCheckTestCase {
verify(createChecker(checkConfig), checkedFiles, aPath, expected);
}
public void failingTestOverlapping() throws Exception
{
final DefaultConfiguration checkConfig = createCheckConfig(StrictDuplicateCodeCheck.class);
checkConfig.addAttribute("min", "3");
final String path = getPath("duplicates/Overlapping.java");
final String[] expected = {
"6: Found duplicate of 3 lines in " + path + ", starting from line 13",
"6: Found duplicate of 5 lines in " + path + ", starting from line 25",
"7: Found duplicate of 5 lines in " + path + ", starting from line 19",
"13: Found duplicate of 3 lines in " + path + ", starting from line 25",
"19: Found duplicate of 4 lines in " + path + ", starting from line 26",
};
final File[] checkedFiles = new File[] {
new File(path),
};
verify(createChecker(checkConfig), checkedFiles, path, expected);
}
}