작성
·
123
0
// test 클래스 일부
@Test
void join() {
//given
Member member = MemberTestUtil.getMemberSample("sample1");
//when, then 생략
}
// MemberTestUtil 클래스
public class MemberTestUtil {
public static Member getMemberSample(String descriptor) {
Member member = new Member(); // Member는 @builder 포함
switch (descriptor) {
case "sample1":
member.builder().id(1L).name("memberA").grade(Grade.VIP);
break;
case "sample2":
member.builder().id(2L).name("memberB").grade(Grade.VIP);
break;
// 생략
}
return member;
}
}
감사합니다. 많은 도움 되었습니다.