작성
·
535
0
해당 클래스를 실행하면 오류가 납니다. 일단 강의에서 회원관리 예제 강의를 듣기 전까지 수업 관련 코딩은 오류없이 잘 구동 됐었습니다.
근데 여기서부터 막히는것 같습니다.
MemoryMemberRepositoryTest를 run하면 아래와 같은 에러가 납니다.
> Task :compileJava UP-TO-DATE
> Task :processResources UP-TO-DATE
> Task :classes UP-TO-DATE
> Task :compileTestJava FAILED
C:\Users\����\Desktop\study\hello-spring\src\test\java\hello\hellospring\repository\MemoryMemberRepositoryTest.java:25: error: no suitable method found for assertThat(Member)
assertThat(member).isEqualTo(result);
^
method MatcherAssert.<T#1>assertThat(String,T#1,Matcher<? super T#1>) is not applicable
(cannot infer type-variable(s) T#1
(actual and formal argument lists differ in length))
method MatcherAssert.<T#2>assertThat(T#2,Matcher<? super T#2>) is not applicable
(cannot infer type-variable(s) T#2
(actual and formal argument lists differ in length))
where T#1,T#2 are type-variables:
T#1 extends Object declared in method <T#1>assertThat(String,T#1,Matcher<? super T#1>)
T#2 extends Object declared in method <T#2>assertThat(T#2,Matcher<? super T#2>)
C:\Users\����\Desktop\study\hello-spring\src\test\java\hello\hellospring\repository\MemoryMemberRepositoryTest.java:26: error: cannot find symbol
Assertions.assertThat(member).isEqualTo(result);
^
symbol: method assertThat(Member)
location: class Assertions
C:\Users\����\Desktop\study\hello-spring\src\test\java\hello\hellospring\repository\MemoryMemberRepositoryTest.java:41: error: no suitable method found for assertThat(Member)
assertThat(result).isEqualTo(member1);
^
method MatcherAssert.<T#1>assertThat(String,T#1,Matcher<? super T#1>) is not applicable
(cannot infer type-variable(s) T#1
(actual and formal argument lists differ in length))
method MatcherAssert.<T#2>assertThat(T#2,Matcher<? super T#2>) is not applicable
(cannot infer type-variable(s) T#2
(actual and formal argument lists differ in length))
where T#1,T#2 are type-variables:
T#1 extends Object declared in method <T#1>assertThat(String,T#1,Matcher<? super T#1>)
T#2 extends Object declared in method <T#2>assertThat(T#2,Matcher<? super T#2>)
C:\Users\����\Desktop\study\hello-spring\src\test\java\hello\hellospring\repository\MemoryMemberRepositoryTest.java:55: error: no suitable method found for assertThat(int)
assertThat(result.size()).isEqualTo(2);
^
method MatcherAssert.<T#1>assertThat(String,T#1,Matcher<? super T#1>) is not applicable
(cannot infer type-variable(s) T#1
(actual and formal argument lists differ in length))
method MatcherAssert.<T#2>assertThat(T#2,Matcher<? super T#2>) is not applicable
(cannot infer type-variable(s) T#2
(actual and formal argument lists differ in length))
where T#1,T#2 are type-variables:
T#1 extends Object declared in method <T#1>assertThat(String,T#1,Matcher<? super T#1>)
T#2 extends Object declared in method <T#2>assertThat(T#2,Matcher<? super T#2>)
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
4 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileTestJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 3s
3 actionable tasks: 1 executed, 2 up-to-date
그리고 화면 내에 store 에 저렇게 음영이 져있는데 어떻게 해야할지 모르겠습니다.
store에 알트엔터누르면 나오는 메뉴에서 뭘 선택해야 할지
모르겠습니다 .ㅜ
그리고 상단에 저렇게 오류가 나는데 어떤식으로 접근해서 어떻게 해결을 해야할지 잘 감이 오질 않습니다. 알려주시면 배우겠습니다. 부탁드립니다.
답변 1
0
제 생각에는.. Assertions 명령어가 두 개 존재합니다. 하나는 junit 라이브러리에서 지원하는 method고 이 assertion 객체는 assertThat method를 가지고 있지 않습니다. 다른 하나는 assertj 라이브러리를 사용하는 Assertions입니다.
intellij의 자동완성으로 명령어를 찾아보셔도 되고 org.assertj.core.api를 import해서 사용해보시면 될거 같습니다.
추가적으로 stack overflow에 올려지는 대부분의 답변들도 그렇지만 code를 screenshot으로 찍어서 올리는 건 비추합니다. 확대도 안되고 제대로 보이지도 않거든요.
안녕하세요. JS님, 공식 서포터즈 OMG입니다.
온고로님 말씀하신 부분이 의심스럽네요. import문 확인해보세요
> Task :compileJava UP-TO-DATE
> Task :processResources UP-TO-DATE
> Task :classes UP-TO-DATE
> Task :compileTestJava FAILED
C:\Users\����\Desktop\study\hello-spring\src\test\java\hello\hellospring\repository\MemoryMemberRepositoryTest.java:25: error: no suitable method found for assertThat(Member)
assertThat(member).isEqualTo(result);
^
method MatcherAssert.<T#1>assertThat(String,T#1,Matcher<? super T#1>) is not applicable
감사합니다.