오류내용

gradle에서 dependencies 추가 후 테스트 코드 실행하면 오류가 발생

dependencies {
    api libs.com.google.guava.guava
    api libs.ch.qos.logback.logback.classic
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
}

테스트 코드 작성

public class HttpRequestUtilsTest {
	@Test
	public void testDivide() {
		assertThrows(ArithmeticException.class, () -> {
			Integer.divideUnsigned(42, 0);
		});
	}
}
org.gradle.api.tasks.testing.TestExecutionException: No matching tests found in any candidate test task.
    Requested tests:
        Test pattern util.HttpRequestUtilsTest.testDivide in task :test
        
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.8/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 2s
4 actionable tasks: 1 executed, 3 up-to-date

해결

useJUnitPlatform()을 선언을 안해서 gradle에서 test 코드를 못읽어서 생긴 오류

test {
    useJUnitPlatform()
}