public class MethodInstrumenter extends Object
| Constructor and Description |
|---|
MethodInstrumenter(org.codehaus.groovy.ast.ClassNode classRef,
boolean isRecordingTestResults,
boolean isIntervalFlushing,
int flushPolicy) |
| Modifier and Type | Method and Description |
|---|---|
Pair<org.codehaus.groovy.ast.stmt.Statement,Boolean> |
wrapMethodInTryCatch(org.codehaus.groovy.ast.ClassNode currentClassNode,
org.codehaus.groovy.ast.MethodNode method,
FullMethodInfo methodInfo,
int index,
org.codehaus.groovy.ast.stmt.Statement methodEntryInc,
org.codehaus.groovy.ast.stmt.Statement maybeBlockStatement,
Map<String,org.codehaus.groovy.ast.ClassNode> annotationClassNodes)
FOR TEST REWRITING:
|
public MethodInstrumenter(@NotNull
org.codehaus.groovy.ast.ClassNode classRef,
boolean isRecordingTestResults,
boolean isIntervalFlushing,
int flushPolicy)
@NotNull public Pair<org.codehaus.groovy.ast.stmt.Statement,Boolean> wrapMethodInTryCatch(@NotNull org.codehaus.groovy.ast.ClassNode currentClassNode, @NotNull org.codehaus.groovy.ast.MethodNode method, @NotNull FullMethodInfo methodInfo, int index, @NotNull org.codehaus.groovy.ast.stmt.Statement methodEntryInc, @NotNull org.codehaus.groovy.ast.stmt.Statement maybeBlockStatement, @NotNull Map<String,org.codehaus.groovy.ast.ClassNode> annotationClassNodes)
\@Test
\@Expected([RuntimeException.class, FooException.class])
def testFoo() {
someStatements()
}
\@Test
\@Expected([RuntimeException.class, FooException.class])
def testFoo() {
CLASS.R().globalSliceStart(getClass().getName(), $idx$)
CLASS.R().inc($idx$)
Throwable exception = null
try {
someStatements()
} catch (Throwable t) {
exception = t
throw t
} finally {
CLASS.R().globalSliceEnd(
getClass().getName(),
"testFoo",
CLASS.__CLRx_y_z_TEST_NAME_SNIFFER.getTestName(),
$idx$,
RECORDERCLASS.evalTestException(exception, []),
exception)
}
}
FOR FLUSH REWRITING:
def testFoo() {
someStatements()
}
def testFoo() {
try {
someStatements()
} finally {
CLASS.R().maybeFlush() OR CLASS.R().flushNeeded()
}
}
Copyright © 2024 OpenClover.org. All rights reserved.