Skip to content

๐Ÿš€ 4๋‹จ๊ณ„ - ๋กœ๋˜(์ˆ˜๋™)#4161

Open
aj172019 wants to merge 2 commits intonext-step:aj172019from
aj172019:step4
Open

๐Ÿš€ 4๋‹จ๊ณ„ - ๋กœ๋˜(์ˆ˜๋™)#4161
aj172019 wants to merge 2 commits intonext-step:aj172019from
aj172019:step4

Conversation

@aj172019
Copy link

@aj172019 aj172019 commented Apr 6, 2025

No description provided.

@aj172019
Copy link
Author

aj172019 commented Apr 6, 2025

ํ”ผ๋“œ๋ฐฑ ์ž˜ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค~!๐Ÿ˜Š

Copy link
Member

@testrace testrace left a comment

Choose a reason for hiding this comment

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

์•ˆ๋…•ํ•˜์„ธ์š” ์ค€ํ—Œ๋‹˜ ๐Ÿ˜ƒ
๋งˆ์ง€๋ง‰ ๋‹จ๊ณ„ ์ž˜ ๊ตฌํ˜„ํ•ด ์ฃผ์…จ๋„ค์š” ๐Ÿ‘
๋ช‡ ๊ฐ€์ง€ ์ฝ”๋ฉ˜ํŠธ ๋‚จ๊ฒจ๋‘์—ˆ๋Š”๋ฐ ํ™•์ธํ•ด ์ฃผ์‹œ๊ณ  ๋‹ค์‹œ ๋ฆฌ๋ทฐ ์š”์ฒญํ•ด ์ฃผ์„ธ์š”.

Comment on lines +29 to +31
public IntStream intStream() {
return IntStream.range(0, value);
}
Copy link
Member

Choose a reason for hiding this comment

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

ํ‰์†Œ์—๋„ ์ŠคํŠธ๋ฆผ์„ ๋ฐ˜ํ™˜ํ•˜๋Š” ๋กœ์ง์„ ์ž์ฃผ ์‚ฌ์šฉํ•˜์‹œ๋‚˜์š”?
์–ด๋–ค ์žฅ์ ์ด ์žˆ๋‹ค๊ณ  ํŒ๋‹จํ•˜์…จ๋Š”์ง€ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค.

Comment on lines +33 to +36
public LottoCount minus(LottoCount other) {
validateMinus(other);
return LottoCount.of(this.value - other.value);
}
Copy link
Member

Choose a reason for hiding this comment

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

๋ถˆ๋ณ€ ๊ฐ์ฒด ํ™œ์šฉ ๐Ÿ‘

Comment on lines +23 to +36
@Override
public LottoTickets read() {
LottoTicketsManuelInputStrategy lottoTicketsManuelInputStrategy = LottoTicketsManuelInputStrategy.ofSystemIn(lottoManuelCount);
LottoTicketsManualInput lottoTicketsManualInput = LottoTicketsManualInput.create(lottoTicketsManuelInputStrategy);
LottoTickets manualLottoTickets = lottoTicketsManualInput.action();

LottoCount lottoAutoCount = lottoAmount.getLottoCount().minus(lottoManuelCount);

LottoTicketsAutoInputStrategy lottoTicketsAutoInputStrategy = LottoTicketsAutoInputStrategy.of(lottoAutoCount);
LottoTicketsAutoInput lottoTicketsAutoInput = LottoTicketsAutoInput.create(lottoTicketsAutoInputStrategy, lottoAutoCount, lottoManuelCount);
LottoTickets autoLottoTickets = lottoTicketsAutoInput.action();

return LottoTickets.of(manualLottoTickets, autoLottoTickets);
}
Copy link
Member

Choose a reason for hiding this comment

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

๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•˜๋Š” ๋กœ์ง์ด View, Controller ์–ด๋А์ชฝ์˜ ์ฑ…์ž„์— ๋” ๊ฐ€๊น๋‹ค๊ณ  ์ƒ๊ฐํ•˜์‹œ๋‚˜์š”?
LottoCount lottoAutoCount = lottoAmount.getLottoCount().minus(lottoManuelCount);
๋ฉ”์‹œ์ง€๋ฅผ ๋ณด๋‚ด๋Š” ๋กœ์ง ๋˜ํ•œ view์— ์žˆ์œผ๋‹ˆ controller์˜ ์—ญํ• ๋„ ๊ฒธํ•˜๊ณ  ์žˆ๋Š” ๊ฒƒ ๊ฐ™์•„์š”.

LottoAmount amount = LottoAmount.of(input);
assertEquals(input, amount.getValue());
assertEquals(expectedCount, amount.lottoCount());
assertEquals(expectedCount, amount.getLottoCount().getCount());
Copy link
Member

Choose a reason for hiding this comment

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

๊ฐ์ฒด ๊ทธ๋ž˜ํ”„๊ฐ€ ๊นŠ์–ด์ง€๋ฉด get..get..get..get.. ๋  ๊ฐ€๋Šฅ์„ฑ์ด ๋†’์Šต๋‹ˆ๋‹ค.
๋””๋ฏธํ„ฐ ๋ฒ•์น™์„ ์ ์šฉํ•ด ๋ณด์‹œ๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š”

Comment on lines +29 to +37
@Test
@DisplayName("LottoCount.minus๋กœ ์ •์ƒ์ ์œผ๋กœ ๊ฐ’์„ ๋บ„ ์ˆ˜ ์žˆ๋‹ค")
void minusShouldSubtractProperly() {
LottoCount base = LottoCount.of(5);
LottoCount subtract = LottoCount.of(2);

LottoCount result = base.minus(subtract);
assertEquals(3, result.getCount());
}
Copy link
Member

Choose a reason for hiding this comment

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

minus ๋ฉ”์„œ๋“œ๋Š” ๋„๋ฉ”์ธ ๋กœ์ง์—์„  ์‚ฌ์šฉ๋˜๊ณ  ์žˆ์ง€ ์•Š๊ณ  view์˜ InputStrategy ์—์„œ๋งŒ ํ™œ์šฉ๋˜๊ณ  ์žˆ์–ด์š”.
ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์š”๊ตฌ์‚ฌํ•ญ๋Œ€๋กœ TDD ์‚ฌ์ดํด์„ ์‹œ๋„ํ•ด๋ณด์…จ์„๊นŒ์š”?
์ปค๋ฐ‹๋„ ์ž‘์€ ๋‹จ์œ„๊ฐ€ ์•„๋‹ˆ์—ฌ์„œ ๊ตฌํ˜„ ํ๋ฆ„์„ ํŒŒ์•…ํ•˜๊ธฐ ์–ด๋ ต๋„ค์š”.

Comment on lines +63 to +65
Copy link
Member

Choose a reason for hiding this comment

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

์š”๊ตฌ์‚ฌํ•ญ๋Œ€๋กœ '๊ธฐ๋Šฅ ๋ชฉ๋ก'์„ ์ž‘์„ฑํ•ด ๋ณด์‹œ๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š”.

Copy link
Member

Choose a reason for hiding this comment

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

์ •์ƒ์ ์œผ๋กœ ๋™์ž‘ํ•˜๊ณ  ์žˆ์ง€ ์•Š๋„ค์š” ๐Ÿ˜ข
image

Comment on lines +30 to +35
public LottoTickets read() {
List<LottoTicket> manualTickets = lottoCount.intStream()
.mapToObj(count -> getLottoTicket())
.collect(Collectors.toList());

return LottoTickets.of(manualTickets);
Copy link
Member

Choose a reason for hiding this comment

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

ManualInputStrategy ๋„ FixedPicker๋ฅผ ํ™œ์šฉํ•˜๋ฉด ์–ด๋–จ๊นŒ์š”?
AutoInputStrategy ๋Š” AutoPicker๋ฅผ ํ™œ์šฉํ•˜๋”๋ผ๊ตฌ์š”.

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.

3 participants