-
Notifications
You must be signed in to change notification settings - Fork 301
๐ 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
base: wlwpfh
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๋จ๊ณ๋ ์์งํํด์ฃผ์
จ์ต๋๋ค ๐
๋ช๊ฐ์ง ์ฝ๋ฉํธ ๋จ๊ฒจ๋์์ด์~
ํ์ธ ํ ์ฌ์์ฒญ ๋ถํ๋๋ฆฝ๋๋ค!
๊ทธ๋ผ ํ์ดํ ์ ๋๋ค!
this.sessionCapacity = sessionCapacity; | ||
} | ||
|
||
public Enrollment(SessionCapacity sessionCapacity) { |
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.
PR์์ฒญ์ ์ฌ์ฉํ์ง ์๋ ๋ฉ์๋๋ ๊ณผ๊ฐํ ์ ๊ฑฐํ๋๊ฒ์ด ์ข๋ค๊ณ ์๊ฐํฉ๋๋ค.
ํน์ ์ถํ ์ฐธ๊ณ ํด์ผ๋๋ ์ฝ๋๋ผ๋ฉด, ์ ์ ํ commit๋ฉ์์ง๋ก ๋จ๊ฒจ ๋๋๊ฒ๋ ํ๋์ ๋ฐฉ๋ฒ์ผ๊ฒ ๊ฐ์ต๋๋ค ๐ค
} | ||
|
||
private boolean canApply(LocalDate enrollDate, Payment payment) { | ||
if (!state.canRecruit()) { |
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.
if (!state.canRecruit()) { | |
if (state.cannotRecruit()) { |
!
ํํ ๋ณด๋ค๋ ์๋ ๊ทธ๋๋ก ๋ฉ์๋๋ช
์ผ๋ก ํํํ๋๊ฒ ๊ฐ๋
์ฑ์ ์ข์์๋ ์๋ค๊ณ ์๊ฐ๋๋ค์ ๐ค
public void increase() { | ||
capacity++; | ||
isValidCapacity(); | ||
} |
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 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ํฝ์ ์ด์์ด์ด์ผ ํ๋ค."); |
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.
์กฐ๊ฑด์ด ๋ณ๊ฒฝ๋ ๋๋ง๋ค ์์ธ ๋ฉ์์ง๊น์ง ํจ๊ป ๋ณ๊ฒฝํด์ผํ๋๊ฒ์ ์ ์ง๋ณด์์ ๋ฆฌ์คํฌ๊ฐ ์์ง ์์๊น์?
@@ -0,0 +1,11 @@ | |||
package nextstep.courses; | |||
|
|||
public class InvalidImageException extends RuntimeException { |
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.
๋จ์ํ ๋ฉ์์ง๋ง ๋ฐ๋๊ฒ์ด๋ผ๋ฉด,
java ๊ธฐ๋ณธ excpetion์ผ๋ก ์ฌ์ฉํ ์ ์์์ ํ
๋ฐ,
custom 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.
ํ์ฌ ๋๋ฉ์ธ๋ณ๋ก custom exception์ผ๋ก ์์ธ์ฒ๋ฆฌ๋ฅผ ํ์ฌ ์ด์ ๊ฐ๊ฒ ์งํํ์์ต๋๋ค..!
this.startDate = startDate; | ||
this.endDate = 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.
endDate๊ฐ startDate๋ณด๋ค ์ด์ ์ด๋ฉด ๊ฐ์ฒด๊ฐ ์์ฑ์๋๊ฒ ํ๋๊ฒ ๋ ํ์คํ์ง ์์๊น์? ์๋๋ฉด, endDate๊ฐ startDate๋ณด๋ค ์ด์ ์ด๋ผ๋ ์์ฑ๋์ด์ผํ๋ ๊ฒฝ์ฐ๊ฐ ์๋์?
if (payment.isSameAmount(price)) | ||
return true; | ||
return false; |
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.
if (payment.isSameAmount(price)) | |
return true; | |
return false; | |
return payment.isSameAmount(price); |
์ฝ๊ฒ ํํํ ์์๋๊ฒ์ ์ฝ๊ฒ ํํํด๋ ์ข์๊ฒ ๊ฐ์์~
FreePaymentStrategy freePaymentStrategy = new FreePaymentStrategy(); | ||
assertTrue(freePaymentStrategy.payable(new Payment())); | ||
} | ||
|
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
๊ฐ ์
๋ ฅ๋์ด๋ ์ํ๋๋๊ฒ ์์ ํ ๊น์?
@Test
public void free2(){
FreePaymentStrategy freePaymentStrategy = new FreePaymentStrategy();
assertTrue(freePaymentStrategy.payable(new Payment("1", 1L, 1L, 1000L)));
}
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.
FreePaymentStrategy์์๋ ๋ชจ๋ true๋ฅผ ๋ฐํํ๊ธฐ ๋๋ฌธ์ ๊ด์ฐฎ๋ค๊ณ ์๊ฐํ์์ต๋๋ค!
- [x] ๊ฐ์๋ ๊ฐ์ ์ปค๋ฒ ์ด๋ฏธ์ง ์ ๋ณด๋ฅผ ๊ฐ์ง๋ค. | ||
- [ ] ๊ฐ์๋ ๋ฌด๋ฃ ๊ฐ์์ ์ ๋ฃ ๊ฐ์๋ก ๋๋๋ค. | ||
- [ ] ๋ฌด๋ฃ ๊ฐ์๋ ์ต๋ ์๊ฐ ์ธ์ ์ ํ์ด ์๋ค. |
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.
ํด๋น ์๊ตฌ์ฌํญ์ด ๊ตฌํ๋์ง ์์์ด์ ๊ฐ ์์๊น์?
์๋ ํ์ธ์. ์ด๋ฒ ๋จ๊ณ ๋ฆฌ๋ทฐ ์๋ถํ๋๋ฆฝ๋๋ค.
๊ฐ์ฌํฉ๋๋ค!