강의

멘토링

로드맵

Inflearn brand logo image

인프런 커뮤니티 질문&답변

guswhd903님의 프로필 이미지
guswhd903

작성한 질문수

Could not initialize plugin: interface org.mockito.plugins.MockMaker

해결된 질문

작성

·

67

0

환경설정이 문제인걸까요..? 아래의 테스트 코드 실행시 아래와 같은오류가 발생합니다. 도와주세요ㅠㅠ

<gradle파일>

plugins {
	id 'java'
	id 'org.springframework.boot' version '3.4.1'
	id 'io.spring.dependency-management' version '1.1.7'
}

group = 'study'
version = '0.0.1-SNAPSHOT'

java {
	toolchain {
		languageVersion = JavaLanguageVersion.of(17)
	}
}

java {
	toolchain {
		languageVersion = JavaLanguageVersion.of(17)
	}
}

configurations {
	compileOnly {
		extendsFrom annotationProcessor
	}
}

repositories {
	mavenCentral()
}

dependencies {
	implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
	implementation 'org.springframework.boot:spring-boot-starter-web'
	compileOnly 'org.projectlombok:lombok'
	runtimeOnly 'com.h2database:h2'
	annotationProcessor 'org.projectlombok:lombok'
	testImplementation 'org.springframework.boot:spring-boot-starter-test'
	testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}

tasks.named('test') {
	useJUnitPlatform()
}

<test파일>

package study.data_jpa;

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
class DataJpaApplicationTests {

	@Test
	void contextLoads() {
	}

}

<오류>

Could not initialize plugin: interface org.mockito.plugins.MockMaker


Caused by: java.lang.IllegalStateException: Internal problem occurred, please report it. Mockito is unable to load the default implementation of class that is a part of Mockito distribution. Failed to load interface org.mockito.plugins.MockMaker



It appears as if your JDK does not supply a working agent attachment mechanism.
Java               : 17
JVM vendor name    : Oracle Corporation
JVM vendor version : 17.0.10+11-LTS-240
JVM name           : Java HotSpot(TM) 64-Bit Server VM
JVM version        : 17.0.10+11-LTS-240
JVM info           : mixed mode, sharing
OS name            : Windows 10
OS version         : 10.0

DataJpaApplicationTests > contextLoads() FAILED
    java.lang.IllegalStateException at PluginLoader.java:85
        Caused by: java.lang.IllegalStateException at DefaultMockitoPlugins.java:105
            Caused by: java.lang.reflect.InvocationTargetException at Constructor.java:499
                Caused by: org.mockito.exceptions.base.MockitoInitializationException at InlineDelegateByteBuddyMockMaker.java:254
                    Caused by: java.lang.IllegalArgumentException at InstrumentationImpl.java:-2

답변

답변을 기다리고 있는 질문이에요
첫번째 답변을 남겨보세요!
guswhd903님의 프로필 이미지
guswhd903

작성한 질문수

질문하기