inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술

회원 도메인과 리포지토리 만들기

MemoryMemberRepositoryTest 실행 오류

628

뷰린이탈출대작전

작성한 질문수 32

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에 알트엔터누르면  나오는 메뉴에서 뭘 선택해야 할지

모르겠습니다 .ㅜ

그리고 상단에 저렇게 오류가 나는데 어떤식으로 접근해서 어떻게 해결을 해야할지 잘 감이 오질 않습니다. 알려주시면 배우겠습니다. 부탁드립니다.

MVC spring spring-boot java

답변 1

0

온고로

제 생각에는.. Assertions 명령어가 두 개 존재합니다. 하나는 junit 라이브러리에서 지원하는 method고 이 assertion 객체는 assertThat method를 가지고 있지 않습니다. 다른 하나는 assertj 라이브러리를 사용하는 Assertions입니다. 

intellij의 자동완성으로 명령어를 찾아보셔도 되고  org.assertj.core.api를 import해서 사용해보시면 될거 같습니다.

추가적으로 stack overflow에 올려지는 대부분의 답변들도 그렇지만 code를 screenshot으로 찍어서 올리는 건 비추합니다. 확대도 안되고 제대로 보이지도 않거든요.

0

OMG

안녕하세요. 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

감사합니다.

인텔리제이 오류

0

49

1

..

0

112

2

Unused property.....

0

121

2

project JDK is misconfigured

0

165

2

외부 API의 ID 타입(String/UUID)과 내부 도메인의 ID 타입(Long)이 불일치할 때의 설계 정석

0

101

2

단위/통합 테스트 버전충돌 문제

0

102

2

❗️springboot 4.0.2 버전 aspectj dependency 설정❗️

0

255

1

왜 컨트롤러는 변한게 없는데 새로 만든 html 파일이 뜨나요?

0

124

2

윈도우 build test오류 질문

1

122

2

테스트 관련 공부에 대한 조언을 얻고 싶습니다

0

112

2

테스트 실행 시 에러 질문

0

313

1

name을 통한 비교와 객체를 통한 비교

0

81

1

빌드 후 libs 없음

1

148

1

윈도우 gradlew.bat 에러

0

186

1

@PostMapping("/members/new")가 동작하지 않습니다

0

98

1

java static class와 kotlin class

0

89

1

스프링 DB연결

0

145

1

소요 시간

0

96

2

ddl.sql에 빨간 밑줄

1

118

2

welcome page 에러

0

200

3

잘 모르겠습니다.

0

172

2

fail을 똑같이 쳤는데 오류가 발생해요

0

173

2

index.html Welcome page

0

137

1

프로젝트 gradle-groovy ?

0

403

1