Only include support methods and imports from working test cases

This commit is contained in:
Sauyon Lee
2021-08-25 16:13:55 -07:00
parent 2132ee52d5
commit 0d174f2daf

View File

@@ -57,12 +57,17 @@ query string noTestCaseGenerated() {
not exists(any(TestCase tc).getATestSnippetForRow(result))
}
/**
* Gets a valid test case, i.e. one that has a test snippet.
*/
TestCase getAValidTestCase() { exists(result.getATestSnippetForRow(_)) }
/**
* Returns an import statement to include in the test case header.
*/
string getAnImportStatement() {
exists(RefType t |
t = any(TestCase tc).getADesiredImport() and
t = getAValidTestCase().getADesiredImport() and
isImportable(t) and
t.getPackage().getName() != "java.lang"
|
@@ -76,7 +81,7 @@ string getAnImportStatement() {
SupportMethod getASupportMethod() {
result instanceof SourceMethod or
result instanceof SinkMethod or
result = any(TestCase tc).getASupportMethod()
result = getAValidTestCase().getASupportMethod()
}
/**