Skip to content

Commit

Permalink
polish
Browse files Browse the repository at this point in the history
  • Loading branch information
tinder-dthomson committed Oct 30, 2023
1 parent e769377 commit c56a747
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ private static class RewriteExpectationsVisitor extends JavaIsoVisitor<Execution
private static final String PRIMITIVE_RESULT_TEMPLATE = "when(#{any()}).thenReturn(#{});";
private static final String OBJECT_RESULT_TEMPLATE = "when(#{any()}).thenReturn(#{any(java.lang.String)});";
private static final String THROWABLE_RESULT_TEMPLATE = "when(#{any()}).thenThrow(#{any()});";
private static final Pattern EXPECTATIONS_PATTERN = Pattern.compile("^mockit.Expectations$");
private static final Set<String> JMOCKIT_ARGUMENT_MATCHERS = new HashSet<>();
static {
JMOCKIT_ARGUMENT_MATCHERS.add("anyString");
Expand Down Expand Up @@ -93,7 +92,7 @@ public J.MethodDeclaration visitMethodDeclaration(J.MethodDeclaration methodDecl
continue;
}
J.Identifier clazz = (J.Identifier) nc.getClazz();
if (clazz.getType() == null || !clazz.getType().isAssignableFrom(EXPECTATIONS_PATTERN)) {
if (!TypeUtils.isAssignableTo("mockit.Expectations", clazz.getType())) {
continue;
}
// empty Expectations block is considered invalid
Expand Down

0 comments on commit c56a747

Please sign in to comment.