Skip to content
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

Open
wants to merge 12 commits into
base: kbzz17
Choose a base branch
from

Conversation

kbzz17
Copy link

@kbzz17 kbzz17 commented May 13, 2024

payment๊ฐ€ ๊ตฌํ˜„ ์‹œ ์กฐ๊ธˆ ํ—ท๊ฐˆ๋ ธ๋Š”๋ฐ,

์ œ๊ฐ€ ๊ตฌํ˜„ํ•œ Payment, payments์˜ ์˜๋„๊ฐ€ ์ถœ์ œ ์˜๋„์™€ ๋งž๋Š”์ง€ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค !!

kbzz17 added 12 commits May 12, 2024 19:16
Copy link
Contributor

@javajigi javajigi left a 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{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public class CanNotApplyException extends Exception{
public class CanNotApplyException extends Exception {

@@ -13,6 +15,8 @@ public class Course {

private LocalDateTime updatedAt;

private List<Session> sessions;
Copy link
Contributor

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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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 {
Copy link
Contributor

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 {
Copy link
Contributor

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{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public class FreeSession extends Session{
public class FreeSession extends Session {

private final LocalDateTime startDate;
private final LocalDateTime endDate;

public Period(LocalDateTime startDate, LocalDateTime endDate) {
Copy link
Contributor

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 {
Copy link
Contributor

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 {
Copy link
Contributor

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);
Copy link
Contributor

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๊ณผ ๊ฐ™์ด ๋ณต์žกํ•œ ๊ฐ์ฒด์˜ ํ…Œ์ŠคํŠธ ๋ฐ์ดํ„ฐ๋ฅผ ์ƒ์„ฑํ•  ๋•Œ ์–ด๋–ค ๋ฐฉ๋ฒ•์„ ์‚ฌ์šฉํ•  ๊ฒƒ์ธ์ง€ ์„ ํƒํ•ด ๋ณด๋ฉด ์ข‹๊ฒ ๋‹ค.
์ด๋ฒˆ ๊ธฐํšŒ์— ๋‚ด๊ฐ€ ์„ ํ˜ธํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์ ์šฉํ•ด ๋ณด๊ณ  ์•ž์œผ๋กœ๋„ ์ญˆ์šฑ ํ™œ์šฉํ•˜๋Š” ๋ฐฉ์‹์ด๋ฉด ์ข‹๊ฒ ๋‹ค.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants