-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
๐ 2๋จ๊ณ - ์๊ฐ์ ์ฒญ(๋๋ฉ์ธ ๋ชจ๋ธ) ๋ฏธ์ ์๋ฃ #536
base: kbzz17
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2๋จ๊ณ ๋ฏธ์
์ ๋๋ฉ์ธ ๊ฐ์ฒด ์ค๊ณ๋ถํฐ ๊ตฌํ ์ ํ๋ค์. ๐ฏ
์ ์ฒด์ ์ธ ๊ฐ์ฒด ์ค๊ณ ์ ํ๋ค์.
์ถ๊ฐ๋ก ํผ๋๋ฐฑ ๋ช ๊ฐ ๋จ๊ฒผ์ผ๋ ๋ฐ์ํด ๋ณด๋ฉด ์ข๊ฒ ์ด์.
@@ -0,0 +1,9 @@ | |||
package nextstep.courses; | |||
|
|||
public class CanNotApplyException extends Exception{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public class CanNotApplyException extends Exception{ | |
public class CanNotApplyException extends Exception { |
@@ -13,6 +15,8 @@ public class Course { | |||
|
|||
private LocalDateTime updatedAt; | |||
|
|||
private List<Session> sessions; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ธ์ ์ ์ถ๊ฐํ๋ addSession()๊ณผ ๊ฐ์ ๋ฉ์๋๋ ์์ด์ผ ํ์ง ์์๊น?
private final ImageType type; | ||
private final ImageSize size; | ||
|
||
public Image(ImageCapacity capacity, ImageType type, ImageSize size) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public Image(ImageCapacity capacity, ImageType type, ImageSize size) { | |
public Image(int capacity, ImageType type, int width, int height ) { |
์์ ๊ฐ์ ์์ฑ์๋ ์ถ๊ฐ๋ก ์ง์ํ๋ ๊ฒ์ ์ด๋จ๊น?
|
||
import nextstep.courses.OutOfImageCapacityException; | ||
|
||
public class ImageCapacity { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๐
import nextstep.courses.ImageSizeRangeException; | ||
import nextstep.courses.ImageSizeRatioException; | ||
|
||
public class ImageSize { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๐
import nextstep.courses.domain.Course; | ||
import nextstep.courses.domain.Image.Image; | ||
|
||
public class FreeSession extends Session{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public class FreeSession extends Session{ | |
public class FreeSession extends Session { |
private final LocalDateTime startDate; | ||
private final LocalDateTime endDate; | ||
|
||
public Period(LocalDateTime startDate, LocalDateTime endDate) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์์์ผ์ ์ข ๋ฃ์ผ๋ณด๋ค ์์์ผ ํ๋ค๋ ์ ํจ์ฑ ์ฒดํฌ๋ฅผ ์ถ๊ฐํด์ผ ํ์ง ์์๊น?
|
||
public abstract boolean isAppliable(int pay, int order) throws CanNotApplyException; | ||
|
||
public void apply(int pay, NsUser user) throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Session์ ์ธ์คํด์ค ๋ณ์๊ฐ ๋ง์์ง๊ณ ์๋ค.
Session์ด ๊ฐ์ง๋ ๊ฐ ์ค ์๊ฐ์ ์ฒญ๊ณผ ๊ด๋ จ์๋ ๊ฐ์ ๊ฐ์ง๋ Enrollment์ ๊ฐ์ ๊ฐ์ฒด๋ฅผ ๋ถ๋ฆฌํ๊ณ ์๊ฐ ์ ์ฒญ ๋ก์ง์ ์ด ๊ฐ์ฒด๋ก ๋ถ๋ฆฌํ๋ฉด ์ด๋จ๊น?
๋ถ๋ฆฌํ์ ๋ ๊ธฐ๋ฅ ๊ตฌํ ๋ฐ ํ
์คํธ ๊ด์ ์์ ์ป๋ ์ด์ ์ด ์์๊น?
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class Payments { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๊ฒฐ์ ๊ฐ ์๋ฃ๋๋ค๊ณ ๊ฐ์ ํ๊ณ ๊ธฐ๋ฅ ๊ตฌํํ๊ณ ์๊ธฐ ๋๋ฌธ์ Payment ๊ด๋ จํด ํน๋ณํ ๋ง์ ์๊ฐ์ ํฌ์ํ์ง ์์๋ ๋๋ค.
|
||
int fee = 20000; | ||
int limit = 10; | ||
session = new PaidSession(image, period, status, course, fee, limit); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Session ๊ฐ์ฒด์ ๊ฐ์ด ์ธ์คํด์ค ๋ณ์๊ฐ ๋ง์ ๊ฐ์ฒด๋ฅผ ํ
์คํธํ๋ ค๋ฉด ๊ฐ์ฒด๋ฅผ ์์ฑํ๋๋ฐ ์ด๋ ค์์ด ์๋ค.
์ค๋ณต ์ฝ๋ ๋ํ ๋ง์ด ๋ฐ์ํด Session์ ์์ฑํ ๋ ์์ฑ์์ ์ธ์๊ฐ ๋ณ๊ฒฝ๋๋ ๊ฒฝ์ฐ ๋ณ๊ฒฝํ ๋ถ๋ถ์ด ๋ง์์ง๋ค.
https://www.arhohuttunen.com/test-data-builders/ ๋ฌธ์ ์ฐธ๊ณ ํด Session๊ณผ ๊ฐ์ด ๋ณต์กํ ๊ฐ์ฒด์ ํ
์คํธ ๋ฐ์ดํฐ๋ฅผ ์์ฑํ ๋ ์ด๋ค ๋ฐฉ๋ฒ์ ์ฌ์ฉํ ๊ฒ์ธ์ง ์ ํํด ๋ณด๋ฉด ์ข๊ฒ ๋ค.
์ด๋ฒ ๊ธฐํ์ ๋ด๊ฐ ์ ํธํ๋ ๋ฐฉ๋ฒ์ ์ ์ฉํด ๋ณด๊ณ ์์ผ๋ก๋ ์ญ์ฑ ํ์ฉํ๋ ๋ฐฉ์์ด๋ฉด ์ข๊ฒ ๋ค.
payment๊ฐ ๊ตฌํ ์ ์กฐ๊ธ ํท๊ฐ๋ ธ๋๋ฐ,
์ ๊ฐ ๊ตฌํํ Payment, payments์ ์๋๊ฐ ์ถ์ ์๋์ ๋ง๋์ง ๊ถ๊ธํฉ๋๋ค !!