Skip to content

Commit

Permalink
fix package of argument matchers
Browse files Browse the repository at this point in the history
  • Loading branch information
tinder-dthomson committed Oct 30, 2023
1 parent c56a747 commit 0c28f55
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,10 @@ private void rewriteArgumentMatchers(ExecutionContext ctx, List<Object> template
continue;
}
String argumentMatcher = ((J.Identifier) methodArgument).getSimpleName();
maybeAddImport("org.mockito.Mockito", argumentMatcher);
maybeAddImport("org.mockito.ArgumentMatchers", argumentMatcher);
newArguments.add(JavaTemplate.builder(argumentMatcher + "()")
.javaParser(JavaParser.fromJavaVersion().classpathFromResources(ctx, "mockito-core-3.12"))
.staticImports("org.mockito.Mockito." + argumentMatcher)
.staticImports("org.mockito.ArgumentMatchers." + argumentMatcher)
.build()
.apply(
new Cursor(getCursor(), methodArgument),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ void test() {
import org.mockito.junit.jupiter.MockitoExtension;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.anyString;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.when;
@ExtendWith(MockitoExtension.class)
Expand Down Expand Up @@ -516,7 +516,10 @@ void test() {
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.mockito.Mockito.*;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.when;
@ExtendWith(MockitoExtension.class)
class MyTest {
Expand Down

0 comments on commit 0c28f55

Please sign in to comment.