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

나인바틀스님의 프로필 이미지
나인바틀스

작성한 질문수

스프링 MVC 1편 - 백엔드 웹 개발 핵심 기술

회원 관리 웹 애플리케이션 요구사항

MemberRepositoryTest 에러 문의

작성

·

292

0

MemberRepositoryTest 실행 시 다음의 에러가 나고 있습니다
틀린 곳을 찾기 어려운데, 혹 환경 설정의 문제일까요?
 
[Junit 테스트 실행 시, 에러 메시지]
> Task :compileJava UP-TO-DATE > Task :processResources UP-TO-DATE > Task :classes UP-TO-DATE > Task :compileTestJava > Task :processTestResources NO-SOURCE > Task :testClasses > Task :test > Task :test FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':test'. > There were failing tests. See the report at: file:///C:/Users/TWOSOME_GRAM/Desktop/인프런/20220420_스프링MVC%201편/servlet/build/reports/tests/test/index.html * 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 4s 4 actionable tasks: 2 executed, 2 up-to-date

 

 
 
[코드는 다음과 같습니다]
package hello.servlet.domain.member;

import hello.servlet.domain.member.MemberRepository;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.*;

class MemberRepositoryTest {

MemberRepository memberRepository = MemberRepository.getInstance();

@AfterEach
void afterEach() {
memberRepository.clearStore();
}

@Test
void save() {
//given
Member member = new Member("hello", 20);
//when
Member savedMember = memberRepository.save(member);
//then
Member findMember = memberRepository.findById(savedMember.getId());
assertThat(findMember).isEqualTo(savedMember);
}

@Test
void findAll() {
//given
Member member1 = new Member("member1", 20);
Member member2 = new Member("member2", 30);
memberRepository.save(member1);
memberRepository.save(member2);
//when
List<Member> result = memberRepository.findAll();
//Then
assertThat(result.size()).isEqualTo(2);
assertThat(result).contains(member1, member2);
}
}

답변 2

0

해결했습니다. 감사합니다

0

안녕하세요. 바틀스나인님, 공식 서포터즈 OMG입니다.

코드 문제는 아닌 것 같고 설정 관련 이슈로 보입니다.

아래 링크를 참고해주세요 :)

https://www.inflearn.com/questions/172527

해결이 안될 경우 댓글남겨주세요

감사합니다.

나인바틀스님의 프로필 이미지
나인바틀스

작성한 질문수

질문하기