Skip to content

Commit

Permalink
2022-12-26-Mon-15:51
Browse files Browse the repository at this point in the history
  • Loading branch information
liberalwig committed Dec 26, 2022
1 parent aca7b3c commit 38e589b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 16 deletions.
4 changes: 0 additions & 4 deletions src/test/java/hello/core/member/CoreApplicationTests.java

This file was deleted.

21 changes: 13 additions & 8 deletions src/test/java/hello/core/member/MemberServiceTest.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
package hello.core.member;

import hello.core.order.AppConfig;
import hello.core.order.OrderService;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

public class MemberServiceTest {
import static org.assertj.core.api.Assertions.*;

// @BeforeEach
// public void beforeEach() {
// AppConfig appConfig = new AppConfig();
// memberService = appConfig.memberService();
// }
public class MemberServiceTest {

MemberService memberService = new MemberServiceImpl();
MemberService memberService;
OrderService orderService;

@BeforeEach
public void beforeEach(){
AppConfig appConfig = new AppConfig();
memberService = appConfig.memberService();
orderService = appConfig.orderService();
}
@Test
void join() {
//given
Expand All @@ -24,6 +29,6 @@ void join() {
Member findMember = memberService.findMember(1L);

//then
Assertions.assertThat(member).isEqualTo(findMember);
assertThat(member).isEqualTo(findMember);
}
}
17 changes: 13 additions & 4 deletions src/test/java/hello/core/order/OrderServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,23 @@
import hello.core.member.Grade;
import hello.core.member.Member;
import hello.core.member.MemberService;
import hello.core.member.MemberServiceImpl;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;

public class OrderServiceTest {

MemberService memberService = new MemberServiceImpl();
OrderService orderService = new OrderServiceImpl();
MemberService memberService;
OrderService orderService;

@BeforeEach
public void beforeEach(){
AppConfig appConfig = new AppConfig();
memberService = appConfig.memberService();
orderService = appConfig.orderService();
}

@Test
void createOrder() {
Expand All @@ -19,7 +28,7 @@ void createOrder() {
memberService.join(member);

Order order = orderService.createOrder(memberId, "itemA", 10000);
Assertions.assertThat(order.getDiscountPrice()).isEqualTo(1000);
assertThat(order.getDiscountPrice()).isEqualTo(1000);
}

}

0 comments on commit 38e589b

Please sign in to comment.