forked from wbluke/readable-code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDay4.java
More file actions
48 lines (39 loc) · 1.22 KB
/
Copy pathDay4.java
File metadata and controls
48 lines (39 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package cleancode.homework;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class Day4 {
public boolean validateOrder(Order order) {
if (order.getItems().size() == 0) {
log.info("주문 항목이 없습니다.");
return false;
} else {
if (order.getTotalPrice() > 0) {
if (!order.isCustomerInfo()) {
log.info("사용자 정보가 없습니다.");
return false;
} else {
return true;
}
} else if (!(order.getTotalPrice() > 0)) {
log.info("올바르지 않은 총 가격입니다.");
return false;
}
}
return true;
}
public boolean validateOrder2(Order order) {
if (order.isItemEmpty()) {
log.info("주문 항목이 없습니다.");
return false;
}
if (order.isInvalidPrice()) {
log.info("올바르지 않은 총 가격입니다.");
return false;
}
if (order.isCustomerInfoEmpty()) {
log.info("사용자 정보가 없습니다.");
return false;
}
return true;
}
}