-
Notifications
You must be signed in to change notification settings - Fork 301
Step2 #684
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
jihyun-s
wants to merge
27
commits into
next-step:jihyun-s
Choose a base branch
from
jihyun-s:step2
base: jihyun-s
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Step2 #684
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
287591e
refactor step1
kakao-sophia-song 25fa127
refactor step1
kakao-sophia-song d17c3ca
update readme
kakao-sophia-song ae553db
class 껍데기 생성
kakao-sophia-song 4a6b84a
[feat] SessionStatus
kakao-sophia-song 8229d60
[feat] Period
kakao-sophia-song 6bb6d4a
[feat] NsUsers
kakao-sophia-song 9c4ca04
[feat] Sessions
kakao-sophia-song 2b438ed
[feat] DimensionTest
kakao-sophia-song 3255c2f
[feat] Dimension
kakao-sophia-song 92250b1
[feat] ImageType
kakao-sophia-song e569170
[feat] ImageMeta
kakao-sophia-song 709c80d
[feat] Image test
kakao-sophia-song 0fb8c8f
[feat] Image
kakao-sophia-song f1c5f49
[feat] PaidPolicyTest
kakao-sophia-song 9a3ef7e
[feat] PaidPolicy
kakao-sophia-song 5e789c8
[feat] SessionInformation
kakao-sophia-song da07e3b
updqte readme
kakao-sophia-song a89dc5d
[feat] EnrollmentManagerTest
kakao-sophia-song 55d59e2
[feat] EnrollmentManager
kakao-sophia-song 59265e9
[feat] SessionTest
kakao-sophia-song 98e940b
[feat] Session
kakao-sophia-song 40a9966
[feat] 기능구현 마무리
kakao-sophia-song f9d8f04
피드백 반영
kakao-sophia-song 06e1441
package 위치 수정
kakao-sophia-song 1d255df
테스트 수정
kakao-sophia-song fc4e374
테스트 수정
kakao-sophia-song File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package nextstep.image.domain; | ||
|
||
public class Dimension { | ||
Comment on lines
+1
to
+3
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 패키지를 분리해 주셨네요 👍 |
||
private static final int MIN_WIDTH = 300; | ||
private static final int MIN_HEIGHT = 200; | ||
private static final int WIDTH_RATIO = 3; | ||
private static final int HEIGHT_RATIO = 2; | ||
|
||
private final int width; | ||
private final int height; | ||
|
||
public Dimension(int width, int height) { | ||
validate(width, height); | ||
|
||
this.width = width; | ||
this.height = height; | ||
} | ||
|
||
private void validate(int width, int height) { | ||
if (width < MIN_WIDTH) { | ||
throw new IllegalArgumentException("너비는 " + MIN_WIDTH + " 이상이어야 합니다."); | ||
} | ||
if (height < MIN_HEIGHT) { | ||
throw new IllegalArgumentException("높이는 " + MIN_HEIGHT + " 이상이어야 합니다."); | ||
} | ||
if (width * HEIGHT_RATIO != height * WIDTH_RATIO) { | ||
throw new IllegalArgumentException("비율이 맞지 않습니다. " + WIDTH_RATIO + ":" + HEIGHT_RATIO); | ||
} | ||
} | ||
|
||
public int width() { | ||
return width; | ||
} | ||
|
||
public int height() { | ||
return height; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package nextstep.image.domain; | ||
|
||
public class Image { | ||
private static final long MAX_SIZE_IN_BYTES = 1_048_576; // 1MB | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
private final ImageMeta meta; | ||
private final Dimension dimension; | ||
|
||
public Image(ImageMeta meta, Dimension dimension) { | ||
validate(meta, dimension); | ||
this.meta = meta; | ||
this.dimension = dimension; | ||
} | ||
|
||
private void validate(ImageMeta meta, Dimension dimension) { | ||
if (meta.size() > MAX_SIZE_IN_BYTES) { | ||
throw new IllegalArgumentException("이미지 크기는 1MB 이하여야 합니다."); | ||
} | ||
} | ||
|
||
public ImageMeta meta() { | ||
return meta; | ||
} | ||
|
||
public Dimension dimension() { | ||
return dimension; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package nextstep.image.domain; | ||
|
||
public class ImageMeta { | ||
private final String fileName; | ||
private final ImageType contentType; | ||
private final long size; | ||
|
||
public ImageMeta(String fileName, ImageType contentType, long size) { | ||
this.fileName = fileName; | ||
this.contentType = contentType; | ||
this.size = size; | ||
} | ||
|
||
public String fileName() { | ||
return fileName; | ||
} | ||
|
||
public ImageType contentType() { | ||
return contentType; | ||
} | ||
|
||
public long size() { | ||
return size; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package nextstep.image.domain; | ||
|
||
import java.util.Arrays; | ||
import java.util.Optional; | ||
|
||
public enum ImageType { | ||
GIF("image/gif"), | ||
JPEG("image/jpeg"), | ||
JPG("image/jpg"), | ||
PNG("image/png"), | ||
SVG("image/svg+xml"); | ||
|
||
private final String contentType; | ||
|
||
ImageType(String contentType) { | ||
this.contentType = contentType; | ||
} | ||
|
||
public String contentType() { | ||
return contentType; | ||
} | ||
|
||
public static Optional<ImageType> from(String type) { | ||
return Arrays.stream(values()) | ||
.filter(t -> t.contentType.equalsIgnoreCase(type)) | ||
.findFirst(); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package nextstep.policy.domain; | ||
|
||
import nextstep.payments.domain.Payment; | ||
|
||
public class FreePolicy implements Policy { | ||
|
||
@Override | ||
public void validate(Payment payment, int currentParticipants) { | ||
// nothing to validate | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package nextstep.policy.domain; | ||
|
||
import nextstep.payments.domain.Payment; | ||
|
||
public class PaidPolicy implements Policy { | ||
private final int max; | ||
private final long fee; | ||
|
||
public PaidPolicy(int max, long fee) { | ||
this.max = max; | ||
this.fee = fee; | ||
} | ||
|
||
@Override | ||
public void validate(Payment payment, int currentParticipants) { | ||
if (currentParticipants >= max) { | ||
throw new IllegalStateException("정원 초과입니다."); | ||
} | ||
if (!payment.amount().equals(fee)) { | ||
throw new IllegalArgumentException("결제 금액이 일치하지 않습니다."); | ||
} | ||
} | ||
|
||
public int max() { | ||
return max; | ||
} | ||
|
||
public long fee() { | ||
return fee; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package nextstep.policy.domain; | ||
|
||
import nextstep.payments.domain.Payment; | ||
|
||
public interface Policy { | ||
void validate(Payment payment, int currentParticipants); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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으로 이미 표현이 된게 아닐까요?
강의 소개 페이지에서 스크롤을 마지막까지 내려보시면 여러 기수가 진행되었음을 확인할 수 있는데요.
그러니 Course는 'TDD, 클린 코드 with Java', Session을 '20기'로 볼 수 있을 것 같은데 어떻게 생각하시나요?