Skip to content

Commit

Permalink
Cache CtMethod's TestFramework (#113)
Browse files Browse the repository at this point in the history
Signed-off-by: André Silva <[email protected]>
  • Loading branch information
andre15silva authored Aug 5, 2021
1 parent 84c85fa commit 7e7c265
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public static void init(Factory factory) {
_instance = new TestFramework(factory);
}

private HashMap<CtMethod<?>, TestFrameworkSupport> cachedTestFrameworks;

private List<TestFrameworkSupport> testFrameworkSupportList;

public static TestFramework get() {
Expand All @@ -49,6 +51,7 @@ public static TestFramework get() {

private TestFramework(Factory factory) {
this.factory = factory;
this.cachedTestFrameworks = new HashMap<>();
this.testFrameworkSupportList = new ArrayList<>();
this.testFrameworkSupportList.add(new JUnit3Support());
this.testFrameworkSupportList.add(new JUnit4Support());
Expand Down Expand Up @@ -163,8 +166,10 @@ private TestFrameworkSupport getTestFramework(CtMethod<?> testMethod) {
DSpotCache.getTestFrameworkCache().put(TypeUtils.getQualifiedName(originalMethod), tfs);
}
return tfs;*/
// TODO Enable the cache in test-runner
return getTestFrameworkImpl(testMethod);
if (!cachedTestFrameworks.containsKey(testMethod)) {
cachedTestFrameworks.put(testMethod, getTestFrameworkImpl(testMethod));
}
return cachedTestFrameworks.get(testMethod);
}


Expand Down

0 comments on commit 7e7c265

Please sign in to comment.