Skip to content

Commit 5c0df3b

Browse files
committed
merge : w2-3 to w2-4
2 parents cf8c1a1 + 410e4c2 commit 5c0df3b

40 files changed

+159
-20
lines changed

src/main/java/com/programmers/springweekly/ConsoleApplication.java

+1
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,5 @@ public void run(String... args) {
4545
}
4646
}
4747
}
48+
4849
}

src/main/java/com/programmers/springweekly/ConsoleCustomer.java

+1
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,5 @@ private void getBlackList() {
8383

8484
console.outputGetCustomerList(customerBlacklistResponse);
8585
}
86+
8687
}

src/main/java/com/programmers/springweekly/ConsoleVoucher.java

+1
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,5 @@ private void selectVoucher() {
7777

7878
console.outputGetVoucherAll(voucherListResponse);
7979
}
80+
8081
}

src/main/java/com/programmers/springweekly/VoucherProgramApplication.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ public class VoucherProgramApplication {
99
public static void main(String[] args) {
1010
SpringApplication.run(VoucherProgramApplication.class, args);
1111
}
12+
1213
}
13-

src/main/java/com/programmers/springweekly/domain/CustomerMenu.java

+1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ public static CustomerMenu from(String type) {
1414
throw new IllegalArgumentException("Input: " + type + ", 찾으시는 고객 메뉴가 없습니다.");
1515
}
1616
}
17+
1718
}

src/main/java/com/programmers/springweekly/domain/ProgramMenu.java

+1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ public static ProgramMenu from(String type) {
1313
throw new IllegalArgumentException("Input: " + type + ", 찾으시는 프로그램 메뉴가 없습니다.");
1414
}
1515
}
16+
1617
}

src/main/java/com/programmers/springweekly/domain/VoucherMenu.java

+1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ public static VoucherMenu from(String type) {
1313
throw new IllegalArgumentException("Input: " + type + ", 찾으시는 바우처 메뉴가 없습니다.");
1414
}
1515
}
16+
1617
}

src/main/java/com/programmers/springweekly/domain/customer/Customer.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
package com.programmers.springweekly.domain.customer;
22

3+
import java.util.UUID;
34
import lombok.Builder;
45
import lombok.Getter;
56

6-
import java.util.UUID;
7-
87
@Getter
98
public class Customer {
109

@@ -20,4 +19,5 @@ public Customer(UUID customerId, String customerName, String customerEmail, Cust
2019
this.customerEmail = customerEmail;
2120
this.customerType = customerType;
2221
}
22+
2323
}

src/main/java/com/programmers/springweekly/domain/customer/CustomerType.java

+1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ public static CustomerType from(String type) {
1515
public static boolean isBlacklistedCustomer(CustomerType customerType) {
1616
return customerType == CustomerType.BLACKLIST;
1717
}
18+
1819
}

src/main/java/com/programmers/springweekly/domain/voucher/FixedAmountVoucher.java

+1
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,5 @@ public long getVoucherAmount() {
3131
public VoucherType getVoucherType() {
3232
return VoucherType.FIXED;
3333
}
34+
3435
}

src/main/java/com/programmers/springweekly/domain/voucher/PercentDiscountVoucher.java

+1
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,5 @@ public long getVoucherAmount() {
3131
public VoucherType getVoucherType() {
3232
return VoucherType.PERCENT;
3333
}
34+
3435
}

src/main/java/com/programmers/springweekly/domain/voucher/Voucher.java

+1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ public interface Voucher {
1111
long getVoucherAmount();
1212

1313
VoucherType getVoucherType();
14+
1415
}

src/main/java/com/programmers/springweekly/domain/voucher/VoucherFactory.java

+4-9
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,9 @@ public class VoucherFactory {
66

77
public static Voucher createVoucher(UUID voucherId, VoucherType voucherType, long discount) {
88

9-
switch (voucherType) {
10-
case FIXED -> {
11-
return new FixedAmountVoucher(voucherId, discount);
12-
}
13-
case PERCENT -> {
14-
return new PercentDiscountVoucher(voucherId, discount);
15-
}
16-
default -> throw new IllegalArgumentException("Input: " + voucherType + "바우처 타입이 없습니다.");
17-
}
9+
return switch (voucherType) {
10+
case FIXED -> new FixedAmountVoucher(voucherId, discount);
11+
case PERCENT -> new PercentDiscountVoucher(voucherId, discount);
12+
};
1813
}
1914
}

src/main/java/com/programmers/springweekly/domain/voucher/VoucherType.java

+1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ public static VoucherType from(String type) {
1111
throw new IllegalArgumentException("Input: " + type + ", 찾으시는 바우처 타입이 없습니다.");
1212
}
1313
}
14+
1415
}

src/main/java/com/programmers/springweekly/dto/customer/request/CustomerCreateRequest.java

+1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ public CustomerCreateRequest(String customerName, String customerEmail, Customer
1717
this.customerEmail = customerEmail;
1818
this.customerType = customerType;
1919
}
20+
2021
}

src/main/java/com/programmers/springweekly/dto/customer/request/CustomerUpdateRequest.java

+1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ public CustomerUpdateRequest(UUID customerId, String customerName, String custom
2020
this.customerEmail = customerEmail;
2121
this.customerType = customerType;
2222
}
23+
2324
}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
package com.programmers.springweekly.dto.customer.response;
22

3-
import lombok.Getter;
4-
53
import java.util.List;
4+
import lombok.Getter;
65

76
@Getter
87
public class CustomerListResponse {
@@ -12,4 +11,5 @@ public class CustomerListResponse {
1211
public CustomerListResponse(List<CustomerResponse> customerList) {
1312
this.customerList = customerList;
1413
}
14+
1515
}

src/main/java/com/programmers/springweekly/dto/customer/response/CustomerResponse.java

+1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ public CustomerResponse(Customer customer) {
1919
this.customerEmail = customer.getCustomerEmail();
2020
this.customerType = customer.getCustomerType();
2121
}
22+
2223
}

src/main/java/com/programmers/springweekly/dto/voucher/request/VoucherCreateRequest.java

+1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ public VoucherCreateRequest(long discountAmount, VoucherType voucherType) {
1515
this.discountAmount = discountAmount;
1616
this.voucherType = voucherType;
1717
}
18+
1819
}

src/main/java/com/programmers/springweekly/dto/voucher/request/VoucherUpdateRequest.java

+1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ public VoucherUpdateRequest(UUID voucherId, long discountAmount, VoucherType vou
1818
this.discountAmount = discountAmount;
1919
this.voucherType = voucherType;
2020
}
21+
2122
}

src/main/java/com/programmers/springweekly/dto/voucher/response/VoucherListResponse.java

+1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ public class VoucherListResponse {
1111
public VoucherListResponse(List<VoucherResponse> voucherList) {
1212
this.voucherList = voucherList;
1313
}
14+
1415
}

src/main/java/com/programmers/springweekly/dto/voucher/response/VoucherResponse.java

+1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ public VoucherResponse(Voucher voucher) {
1717
this.discountAmount = voucher.getVoucherAmount();
1818
this.voucherType = voucher.getVoucherType();
1919
}
20+
2021
}

src/main/java/com/programmers/springweekly/repository/customer/FileCustomerRepository.java

+1
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,5 @@ public void loadingBlackListToMemory() {
5656
log.error("error message: {}", e.getMessage());
5757
}
5858
}
59+
5960
}

src/main/java/com/programmers/springweekly/repository/customer/JdbcTemplateCustomerRepository.java

+1
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,5 @@ private RowMapper<Customer> customerRowMapper() {
131131
.build()
132132
);
133133
}
134+
134135
}

src/main/java/com/programmers/springweekly/repository/voucher/FileVoucherRepository.java

+1
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,5 @@ public Map<UUID, Voucher> findAll() {
6868

6969
return Collections.unmodifiableMap(voucherMap);
7070
}
71+
7172
}

src/main/java/com/programmers/springweekly/repository/voucher/JdbcTemplateVoucherRepository.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import lombok.extern.slf4j.Slf4j;
1111
import org.springframework.context.annotation.Primary;
1212
import org.springframework.context.annotation.Profile;
13-
import org.springframework.dao.EmptyResultDataAccessException;
1413
import org.springframework.jdbc.core.RowMapper;
1514
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
1615
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
@@ -118,4 +117,5 @@ private RowMapper<Voucher> voucherRowMapper() {
118117
)
119118
);
120119
}
120+
121121
}

src/main/java/com/programmers/springweekly/service/VoucherService.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import java.util.List;
1111
import java.util.NoSuchElementException;
1212
import java.util.UUID;
13-
import java.util.stream.Collectors;
1413
import lombok.RequiredArgsConstructor;
1514
import org.springframework.stereotype.Service;
1615

@@ -49,7 +48,7 @@ public VoucherResponse findById(UUID voucherId) {
4948

5049
public VoucherListResponse findAll() {
5150
List<Voucher> voucherList = voucherRepository.findAll();
52-
return new VoucherListResponse(voucherList.stream().map(VoucherResponse::new).collect(Collectors.toList()));
51+
return new VoucherListResponse(voucherList.stream().map(VoucherResponse::new).toList());
5352
}
5453

5554
public void deleteById(UUID voucherId) {

src/main/java/com/programmers/springweekly/util/Validator.java

+1
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,5 @@ private static void validateRange(String inputPercent) {
6161
throw new IllegalArgumentException("Input : " + inputPercent + ", 입력하신 숫자는 범위를 벗어납니다.");
6262
}
6363
}
64+
6465
}

src/main/java/com/programmers/springweekly/view/Input.java

+1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ public interface Input {
2020
CustomerUpdateRequest inputCustomerUpdate(UUID customerId);
2121

2222
UUID inputUUID();
23+
2324
}

src/test/java/com/programmers/springweekly/domain/EnumTest.java

+1
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,5 @@ void customerTypeTest(String input) {
3636
.isInstanceOf(IllegalArgumentException.class)
3737
.hasMessage("Input: " + input + ", 찾으시는 고객 타입이 없습니다.");
3838
}
39+
3940
}

src/test/java/com/programmers/springweekly/domain/customer/CustomerTest.java

+1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ void createCustomer() {
1818
// then
1919
assertThat(customer).isInstanceOf(Customer.class);
2020
}
21+
2122
}

src/test/java/com/programmers/springweekly/domain/voucher/VoucherTest.java

+1
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,5 @@ void proceedPercentDiscount(long discountAmount, long inputPrice, long expectedD
5858
// then
5959
assertThat(discountPrice).isEqualTo(expectedDiscount);
6060
}
61+
6162
}

src/test/java/com/programmers/springweekly/repository/customer/FileCustomerRepositoryTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ void getBlacklistOfFileRepository() {
5353

5454
// then
5555
assertThat(actualBlacklist).usingRecursiveFieldByFieldElementComparator().isEqualTo(expectBlacklist);
56-
5756
}
57+
5858
}

src/test/java/com/programmers/springweekly/repository/customer/JdbcTemplateCustomerRepositoryTest.java

+1
Original file line numberDiff line numberDiff line change
@@ -233,4 +233,5 @@ void deleteAll() {
233233
assertThat(jdbcTemplateCustomerRepository.findAll().size()).isEqualTo(0);
234234

235235
}
236+
236237
}

src/test/java/com/programmers/springweekly/repository/voucher/FileVoucherRepositoryTest.java

+1
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,5 @@ void savePercentVoucherToFileRepository() {
4848
.usingRecursiveComparison()
4949
.isEqualTo(voucher);
5050
}
51+
5152
}

src/test/java/com/programmers/springweekly/repository/voucher/JdbcTemplateVoucherRepositoryTest.java

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import org.junit.jupiter.api.Test;
1414
import org.springframework.beans.factory.annotation.Autowired;
1515
import org.springframework.boot.test.context.SpringBootTest;
16+
import org.springframework.dao.EmptyResultDataAccessException;
1617
import org.springframework.test.context.ActiveProfiles;
1718
import org.springframework.transaction.annotation.Transactional;
1819

@@ -139,4 +140,5 @@ void deleteAll() {
139140
// then
140141
assertThat(voucherRepository.findAll().size()).isEqualTo(0);
141142
}
143+
142144
}

src/test/java/com/programmers/springweekly/repository/voucher/MemoryVoucherRepositoryTest.java

+1
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,5 @@ void getVoucherList() {
7575
// then
7676
assertThat(voucherRepository.findAll()).contains(voucher1, voucher2, voucher3, voucher4);
7777
}
78+
7879
}

src/test/java/com/programmers/springweekly/service/customer/CustomerServiceTest.java

+1
Original file line numberDiff line numberDiff line change
@@ -192,4 +192,5 @@ void deleteAll() {
192192
// then
193193
assertThat(customerListAfter.getCustomerList().size()).isEqualTo(0);
194194
}
195+
195196
}

0 commit comments

Comments
 (0)