Conversation
|
ํผ๋๋ฐฑ ์ ๋ถํ๋๋ฆฝ๋๋ค~!๐ |
testrace
left a comment
There was a problem hiding this comment.
์๋
ํ์ธ์ ์คํ๋ ๐
๋ง์ง๋ง ๋จ๊ณ ์ ๊ตฌํํด ์ฃผ์
จ๋ค์ ๐
๋ช ๊ฐ์ง ์ฝ๋ฉํธ ๋จ๊ฒจ๋์๋๋ฐ ํ์ธํด ์ฃผ์๊ณ ๋ค์ ๋ฆฌ๋ทฐ ์์ฒญํด ์ฃผ์ธ์.
| public IntStream intStream() { | ||
| return IntStream.range(0, value); | ||
| } |
There was a problem hiding this comment.
ํ์์๋ ์คํธ๋ฆผ์ ๋ฐํํ๋ ๋ก์ง์ ์์ฃผ ์ฌ์ฉํ์๋์?
์ด๋ค ์ฅ์ ์ด ์๋ค๊ณ ํ๋จํ์
จ๋์ง ๊ถ๊ธํฉ๋๋ค.
| public LottoCount minus(LottoCount other) { | ||
| validateMinus(other); | ||
| return LottoCount.of(this.value - other.value); | ||
| } |
| @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); | ||
| } |
There was a problem hiding this comment.
๊ฐ์ฒด๋ฅผ ์์ฑํ๋ ๋ก์ง์ด 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()); |
There was a problem hiding this comment.
๊ฐ์ฒด ๊ทธ๋ํ๊ฐ ๊น์ด์ง๋ฉด get..get..get..get.. ๋ ๊ฐ๋ฅ์ฑ์ด ๋์ต๋๋ค.
๋๋ฏธํฐ ๋ฒ์น์ ์ ์ฉํด ๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ์์
| @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()); | ||
| } |
There was a problem hiding this comment.
minus ๋ฉ์๋๋ ๋๋ฉ์ธ ๋ก์ง์์ ์ฌ์ฉ๋๊ณ ์์ง ์๊ณ view์ InputStrategy ์์๋ง ํ์ฉ๋๊ณ ์์ด์.
ํ๋ก๊ทธ๋๋ฐ ์๊ตฌ์ฌํญ๋๋ก TDD ์ฌ์ดํด์ ์๋ํด๋ณด์
จ์๊น์?
์ปค๋ฐ๋ ์์ ๋จ์๊ฐ ์๋์ฌ์ ๊ตฌํ ํ๋ฆ์ ํ์
ํ๊ธฐ ์ด๋ ต๋ค์.
๐ 4๋จ๊ณ - ๋ก๋(์๋).md
Outdated
There was a problem hiding this comment.
์๊ตฌ์ฌํญ๋๋ก '๊ธฐ๋ฅ ๋ชฉ๋ก'์ ์์ฑํด ๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ์์.
| public LottoTickets read() { | ||
| List<LottoTicket> manualTickets = lottoCount.intStream() | ||
| .mapToObj(count -> getLottoTicket()) | ||
| .collect(Collectors.toList()); | ||
|
|
||
| return LottoTickets.of(manualTickets); |
There was a problem hiding this comment.
ManualInputStrategy ๋ FixedPicker๋ฅผ ํ์ฉํ๋ฉด ์ด๋จ๊น์?
AutoInputStrategy ๋ AutoPicker๋ฅผ ํ์ฉํ๋๋ผ๊ตฌ์.

No description provided.