diff --git a/java-compiler-testing/src/test/java/io/github/ascopes/jct/testing/unit/compilers/CompilableTest.java b/java-compiler-testing/src/test/java/io/github/ascopes/jct/testing/unit/compilers/CompilableTest.java index 3bb5b8590..92b5888b3 100644 --- a/java-compiler-testing/src/test/java/io/github/ascopes/jct/testing/unit/compilers/CompilableTest.java +++ b/java-compiler-testing/src/test/java/io/github/ascopes/jct/testing/unit/compilers/CompilableTest.java @@ -47,6 +47,7 @@ import org.junit.jupiter.params.provider.ValueSource; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; +import org.mockito.quality.Strictness; /** * {@link Compilable} tests. @@ -290,7 +291,10 @@ static Stream addPackagePathTestsFor( () -> { // Given var pathLike = stub(PathLike.class); - Compilable compiler = mockCast(new TypeRef<>() {}, withSettings().lenient()); + Compilable compiler = mockCast( + new TypeRef<>() {}, + withSettings().strictness(Strictness.LENIENT) + ); given(compiler.addPath(any(), any(PathLike.class))).will(ctx -> compiler); // Stub this method to keep results consistent, even though we shouldn't call it. // Just keeps the failure test results consistent and meaningful. @@ -310,7 +314,10 @@ static Stream addPackagePathTestsFor( () -> { // Given var path = stub(Path.class); - Compilable compiler = mockCast(new TypeRef<>() {}, withSettings().lenient()); + Compilable compiler = mockCast( + new TypeRef<>() {}, + withSettings().strictness(Strictness.LENIENT) + ); given(compiler.addPath(any(), any(Path.class))).will(ctx -> compiler); // Stub this method to keep results consistent, even though we shouldn't call it. // Just keeps the failure test results consistent and meaningful. @@ -330,7 +337,10 @@ static Stream addPackagePathTestsFor( () -> { // Given var pathLike = stub(PathLike.class); - Compilable compiler = mockCast(new TypeRef<>() {}, withSettings().lenient()); + Compilable compiler = mockCast( + new TypeRef<>() {}, + withSettings().strictness(Strictness.LENIENT) + ); given(compiler.addPath(any(), any(PathLike.class))).will(ctx -> compiler); given(pathLikeAdder.add(compiler, pathLike)).willCallRealMethod(); @@ -347,7 +357,10 @@ static Stream addPackagePathTestsFor( () -> { // Given var path = stub(Path.class); - Compilable compiler = mockCast(new TypeRef<>() {}, withSettings().lenient()); + Compilable compiler = mockCast( + new TypeRef<>() {}, + withSettings().strictness(Strictness.LENIENT) + ); given(compiler.addPath(any(), any(Path.class))).will(ctx -> compiler); given(pathAdder.add(compiler, path)).willCallRealMethod(); @@ -403,7 +416,10 @@ static Stream addModulePathTestsFor( () -> { // Given var pathLike = stub(PathLike.class); - Compilable compiler = mockCast(new TypeRef<>() {}, withSettings().lenient()); + Compilable compiler = mockCast( + new TypeRef<>() {}, + withSettings().strictness(Strictness.LENIENT) + ); // Stub this method to keep results consistent, even though we shouldn't call it. // Just keeps the failure test results consistent and meaningful. given(compiler.addPath(any(), any(PathLike.class))).will(ctx -> compiler); @@ -423,7 +439,10 @@ static Stream addModulePathTestsFor( () -> { // Given var path = stub(Path.class); - Compilable compiler = mockCast(new TypeRef<>() {}, withSettings().lenient()); + Compilable compiler = mockCast( + new TypeRef<>() {}, + withSettings().strictness(Strictness.LENIENT) + ); // Stub this method to keep results consistent, even though we shouldn't call it. // Just keeps the failure test results consistent and meaningful. given(compiler.addPath(any(), any(Path.class))).will(ctx -> compiler); @@ -443,7 +462,10 @@ static Stream addModulePathTestsFor( () -> { // Given var pathLike = stub(PathLike.class); - Compilable compiler = mockCast(new TypeRef<>() {}, withSettings().lenient()); + Compilable compiler = mockCast( + new TypeRef<>() {}, + withSettings().strictness(Strictness.LENIENT) + ); given(compiler.addPath(any(), any(PathLike.class))).will(ctx -> compiler); given(pathLikeAdder.add(compiler, moduleName, pathLike)).willCallRealMethod(); @@ -460,7 +482,10 @@ static Stream addModulePathTestsFor( () -> { // Given var path = stub(Path.class); - Compilable compiler = mockCast(new TypeRef<>() {}, withSettings().lenient()); + Compilable compiler = mockCast( + new TypeRef<>() {}, + withSettings().strictness(Strictness.LENIENT) + ); given(compiler.addPath(any(), any(Path.class))).will(ctx -> compiler); given(pathAdder.add(compiler, moduleName, path)).willCallRealMethod(); diff --git a/java-compiler-testing/src/test/java/io/github/ascopes/jct/testing/unit/compilers/SimpleCompilationFactoryTest.java b/java-compiler-testing/src/test/java/io/github/ascopes/jct/testing/unit/compilers/SimpleCompilationFactoryTest.java index d1c3b317c..6ca843f8d 100644 --- a/java-compiler-testing/src/test/java/io/github/ascopes/jct/testing/unit/compilers/SimpleCompilationFactoryTest.java +++ b/java-compiler-testing/src/test/java/io/github/ascopes/jct/testing/unit/compilers/SimpleCompilationFactoryTest.java @@ -50,6 +50,7 @@ import org.mockito.Answers; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; +import org.mockito.quality.Strictness; /** * {@link SimpleCompilationFactory} tests. @@ -64,19 +65,19 @@ class SimpleCompilationFactoryTest { SimpleCompilationFactory compilationFactory; - @Mock(lenient = true, answer = Answers.RETURNS_DEEP_STUBS) + @Mock(strictness = Strictness.LENIENT, answer = Answers.RETURNS_DEEP_STUBS) StubbedCompiler compiler; - @Mock(lenient = true, answer = Answers.RETURNS_SMART_NULLS) + @Mock(strictness = Strictness.LENIENT, answer = Answers.RETURNS_SMART_NULLS) JavaCompiler jsr199Compiler; - @Mock(lenient = true, answer = Answers.RETURNS_SELF) + @Mock(strictness = Strictness.LENIENT, answer = Answers.RETURNS_SELF) FlagBuilder flagBuilder; - @Mock(lenient = true, answer = Answers.RETURNS_SMART_NULLS) + @Mock(strictness = Strictness.LENIENT, answer = Answers.RETURNS_SMART_NULLS) CompilationTask compilationTask; - @Mock(lenient = true, answer = Answers.RETURNS_DEEP_STUBS) + @Mock(strictness = Strictness.LENIENT, answer = Answers.RETURNS_DEEP_STUBS) SimpleFileManagerTemplate fileManagerTemplate; Boolean expectedCompilationResult; diff --git a/java-compiler-testing/src/test/java/io/github/ascopes/jct/testing/unit/jsr199/diagnostics/TracingDiagnosticListenerTest.java b/java-compiler-testing/src/test/java/io/github/ascopes/jct/testing/unit/jsr199/diagnostics/TracingDiagnosticListenerTest.java index eb63b11dd..14de8bf3b 100644 --- a/java-compiler-testing/src/test/java/io/github/ascopes/jct/testing/unit/jsr199/diagnostics/TracingDiagnosticListenerTest.java +++ b/java-compiler-testing/src/test/java/io/github/ascopes/jct/testing/unit/jsr199/diagnostics/TracingDiagnosticListenerTest.java @@ -53,6 +53,7 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.EnumSource; import org.junit.jupiter.params.provider.MethodSource; +import org.mockito.quality.Strictness; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -388,7 +389,7 @@ static Stream loggingDisabledArgs() { static Diagnostic someDiagnostic(Kind kind, String message) { var diagnostic = stubCast( new TypeRef>() {}, - withSettings().lenient() + withSettings().strictness(Strictness.LENIENT) ); when(diagnostic.getKind()).thenReturn(kind); when(diagnostic.getMessage(any())).thenReturn(message); diff --git a/pom.xml b/pom.xml index 2cabbf7b0..dad1c77aa 100644 --- a/pom.xml +++ b/pom.xml @@ -129,7 +129,7 @@ org.mockito mockito-bom - 4.5.1 + 4.6.0 import pom