Skip to content

๐Ÿš€ 2๋‹จ๊ณ„ - ์ˆ˜๊ฐ•์‹ ์ฒญ(๋„๋ฉ”์ธ ๋ชจ๋ธ) #715

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

Open
wants to merge 15 commits into
base: wlwpfh
Choose a base branch
from

Conversation

wlwpfh
Copy link

@wlwpfh wlwpfh commented Apr 13, 2025

์•ˆ๋…•ํ•˜์„ธ์š”. ์ด๋ฒˆ ๋‹จ๊ณ„ ๋ฆฌ๋ทฐ ์ž˜๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค.

๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค!

Copy link

@wooobo wooobo left a comment

Choose a reason for hiding this comment

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

์•ˆ๋…•ํ•˜์„ธ์š”!
2๋‹จ๊ณ„๋„ ์ž˜์ง„ํ–‰ํ•ด์ฃผ์…จ์Šต๋‹ˆ๋‹ค ๐Ÿ˜„

๋ช‡๊ฐ€์ง€ ์ฝ”๋ฉ˜ํŠธ ๋‚จ๊ฒจ๋†“์•˜์–ด์š”~
ํ™•์ธ ํ›„ ์žฌ์š”์ฒญ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค!

๊ทธ๋Ÿผ ํ™”์ดํŒ…์ž…๋‹ˆ๋‹ค!

this.sessionCapacity = sessionCapacity;
}

public Enrollment(SessionCapacity sessionCapacity) {
Copy link

Choose a reason for hiding this comment

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

PR์š”์ฒญ์‹œ ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š” ๋ฉ”์†Œ๋“œ๋Š” ๊ณผ๊ฐํžˆ ์ œ๊ฑฐํ•˜๋Š”๊ฒƒ์ด ์ข‹๋‹ค๊ณ ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค.
ํ˜น์‹œ ์ถ”ํ›„ ์ฐธ๊ณ ํ•ด์•ผ๋˜๋Š” ์ฝ”๋“œ๋ผ๋ฉด, ์ ์ ˆํ•œ commit๋ฉ”์‹œ์ง€๋กœ ๋‚จ๊ฒจ ๋†“๋Š”๊ฒƒ๋„ ํ•˜๋‚˜์˜ ๋ฐฉ๋ฒ•์ผ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค ๐Ÿค”

}

private boolean canApply(LocalDate enrollDate, Payment payment) {
if (!state.canRecruit()) {
Copy link

Choose a reason for hiding this comment

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

Suggested change
if (!state.canRecruit()) {
if (state.cannotRecruit()) {

!ํ‘œํ˜„ ๋ณด๋‹ค๋Š” ์žˆ๋Š” ๊ทธ๋Œ€๋กœ ๋ฉ”์†Œ๋“œ๋ช…์œผ๋กœ ํ‘œํ˜„ํ•˜๋Š”๊ฒŒ ๊ฐ€๋…์„ฑ์— ์ข‹์„์ˆ˜๋„ ์žˆ๋‹ค๊ณ ์ƒ๊ฐ๋˜๋„ค์š” ๐Ÿค”

Comment on lines +30 to +33
public void increase() {
capacity++;
isValidCapacity();
}
Copy link

Choose a reason for hiding this comment

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

Suggested change
public void increase() {
capacity++;
isValidCapacity();
}
public void increase() {
capacity++;
isValidCapacity();
}

ํ•ด๋‹น ์ฝ”๋“œ๋ฅผ ๋ณด๊ณ  ์˜๋ฌธ์ ์ด ๋“œ๋Š”๊ฒŒ ํ•œ๊ฐ€์ง€ ์žˆ๋Š”๋ฐ์š”,

        try {
            SessionCapacity sessionCapacity = new SessionCapacity(10, 5);
            sessionCapacity.increase();
        } catch (CannotEnrollException e) {
            System.out.println(e.getMessage());
        }

        // blabla

์œ„ ํ…Œ์ŠคํŠธ ์ฝ”๋“œ๋Š” 10์–ด์•ผ ํ• ๊นŒ์š” 11์ด์–ด์•ผํ• ๊นŒ์š”?

๊ทธ๋ ‡๋‹ค๋ฉด ๋ฌด์—‡์ด ๋ฌธ์ œ์ผ๊นŒ์š”?

public void increase() {
    isValidCapacity();
    capacity++;
}

์œ„์น˜๋ฅผ ์กฐ์ •ํ•ด๋ณด๊ฑฐ๋‚˜, capacity ๋ฅผ ๋ถˆ๋ณ€๊ฐ์ฒด๋กœ ๊ด€์  ์ „ํ™˜ ํ›„ ํ•ด๊ฒฐํ•ด๋ณผ์ˆ˜๋„ ์žˆ์„๊ฒ„๊ฐ™๋„ค์š” ๐Ÿค”


private void checkValidSessionImage() {
if (this.width < MIN_WIDTH || this.height < MIN_HEIGHT) {
throw new InvalidImageException("์ด๋ฏธ์ง€์˜ width๋Š” 300ํ”ฝ์…€, height๋Š” 200ํ”ฝ์…€ ์ด์ƒ์ด์–ด์•ผ ํ•œ๋‹ค.");
Copy link

Choose a reason for hiding this comment

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

์กฐ๊ฑด์ด ๋ณ€๊ฒฝ๋ ๋•Œ๋งˆ๋‹ค ์˜ˆ์™ธ ๋ฉ”์‹œ์ง€๊นŒ์ง€ ํ•จ๊ป˜ ๋ณ€๊ฒฝํ•ด์•ผํ•˜๋Š”๊ฒƒ์€ ์œ ์ง€๋ณด์ˆ˜์‹œ ๋ฆฌ์Šคํฌ๊ฐ€ ์žˆ์ง€ ์•Š์„๊นŒ์š”?

@@ -0,0 +1,11 @@
package nextstep.courses;

public class InvalidImageException extends RuntimeException {
Copy link

Choose a reason for hiding this comment

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

๋‹จ์ˆœํžˆ ๋ฉ”์‹œ์ง€๋งŒ ๋ฐ›๋Š”๊ฒƒ์ด๋ผ๋ฉด,
java ๊ธฐ๋ณธ excpetion์œผ๋กœ ์‚ฌ์šฉํ• ์ˆ˜ ์žˆ์—ˆ์„ ํ…๋ฐ,
custom exception์„ ๋งŒ๋“  ์ด์œ ๊ฐ€ ๋ฌด์—‡์ธ์ง€ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค!

Copy link
Author

Choose a reason for hiding this comment

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

ํ˜„์žฌ ๋„๋ฉ”์ธ๋ณ„๋กœ custom exception์œผ๋กœ ์˜ˆ์™ธ์ฒ˜๋ฆฌ๋ฅผ ํ•˜์—ฌ ์ด์™€ ๊ฐ™๊ฒŒ ์ง„ํ–‰ํ•˜์˜€์Šต๋‹ˆ๋‹ค..!

Comment on lines +10 to +11
this.startDate = startDate;
this.endDate = endDate;
Copy link

Choose a reason for hiding this comment

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

endDate๊ฐ€ startDate๋ณด๋‹ค ์ด์ „์ด๋ฉด ๊ฐ์ฒด๊ฐ€ ์ƒ์„ฑ์•ˆ๋˜๊ฒŒ ํ•˜๋Š”๊ฒŒ ๋” ํ™•์‹คํ•˜์ง€ ์•Š์„๊นŒ์š”? ์•„๋‹ˆ๋ฉด, endDate๊ฐ€ startDate๋ณด๋‹ค ์ด์ „์ด๋ผ๋„ ์ƒ์„ฑ๋˜์–ด์•ผํ•˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ๋‚˜์š”?

Comment on lines +14 to +16
if (payment.isSameAmount(price))
return true;
return false;
Copy link

Choose a reason for hiding this comment

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

Suggested change
if (payment.isSameAmount(price))
return true;
return false;
return payment.isSameAmount(price);

์‰ฝ๊ฒŒ ํ‘œํ˜„ํ• ์ˆ˜์žˆ๋Š”๊ฒƒ์€ ์‰ฝ๊ฒŒ ํ‘œํ˜„ํ•ด๋„ ์ข‹์„๊ฒƒ ๊ฐ™์•„์š”~

FreePaymentStrategy freePaymentStrategy = new FreePaymentStrategy();
assertTrue(freePaymentStrategy.payable(new Payment()));
}

Copy link

Choose a reason for hiding this comment

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

๋ฌด๋ฃŒ์ผ๊ฒฝ์šฐ ๊ฒฐ์ œ๊ธˆ์•ก์ด ์žˆ๋Š” Payment๊ฐ€ ์ž…๋ ฅ๋˜์–ด๋„ ์ˆ˜ํ–‰๋˜๋Š”๊ฒŒ ์•ˆ์ „ํ• ๊นŒ์š”?

@Test
public void free2(){
    FreePaymentStrategy freePaymentStrategy = new FreePaymentStrategy();
    assertTrue(freePaymentStrategy.payable(new Payment("1", 1L, 1L, 1000L)));
}

Copy link
Author

Choose a reason for hiding this comment

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

FreePaymentStrategy์—์„œ๋Š” ๋ชจ๋‘ true๋ฅผ ๋ฐ˜ํ™˜ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๊ดœ์ฐฎ๋‹ค๊ณ  ์ƒ๊ฐํ•˜์˜€์Šต๋‹ˆ๋‹ค!

- [x] ๊ฐ•์˜๋Š” ๊ฐ•์˜ ์ปค๋ฒ„ ์ด๋ฏธ์ง€ ์ •๋ณด๋ฅผ ๊ฐ€์ง„๋‹ค.
- [ ] ๊ฐ•์˜๋Š” ๋ฌด๋ฃŒ ๊ฐ•์˜์™€ ์œ ๋ฃŒ ๊ฐ•์˜๋กœ ๋‚˜๋‰œ๋‹ค.
- [ ] ๋ฌด๋ฃŒ ๊ฐ•์˜๋Š” ์ตœ๋Œ€ ์ˆ˜๊ฐ• ์ธ์› ์ œํ•œ์ด ์—†๋‹ค.
Copy link

Choose a reason for hiding this comment

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

ํ•ด๋‹น ์š”๊ตฌ์‚ฌํ•ญ์ด ๊ตฌํ˜„๋˜์ง€ ์•Š์€์ด์œ ๊ฐ€ ์žˆ์„๊นŒ์š”?

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