함수 추출하기
alt + Enter
파라미터 추출
control + alt + P
junit assertThrows
Member member = createMember("KIM");
Item item = createBook("JPA", 10000, 10);
int orderCount = 11;
NotEnoughStockException exception = assertThrows(
NotEnoughStockException.class,
()-> orderService.order(member.getId(), item.getId(), orderCount)
);
String message = exception.getMessage();
System.out.println("message = " + message);
확장자를 html로 설정하여 별도 서버없이 UI확인 가능
mustache:
suffix: .html
build.gradle
에 추가
dependencies {
//...
implementation 'org.springframework.boot:spring-boot-starter-validation'
}
NotEmpty
package jpabook.jpashop.web;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotEmpty;
@Getter
@Setter
public class MemberForm {
@NotEmpty(message = "회원 이름은 필수입니다.")
private String name;
private String city;
private String street;
private String zipcode;
}