Skip to content
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

[OptimistLabyrinth] ๐Ÿš€ 1๋‹จ๊ณ„ - ํ…Œ์ŠคํŠธ๋ฅผ ํ†ตํ•œ ์ฝ”๋“œ ๋ณดํ˜ธ #641

Open
wants to merge 10 commits into
base: optimistlabyrinth
Choose a base branch
from

Conversation

OptimistLabyrinth
Copy link

@OptimistLabyrinth OptimistLabyrinth commented Nov 28, 2022

๋งˆํฌ๋‹ค์šด ๋ฌธ๋ฒ• ์‚ฌ์šฉํ•ด์„œ ํ‘œ(ํ…Œ์ด๋ธ”)๋กœ ์ •๋ฆฌ๊นŒ์ง€ ์™„๋ฃŒํ–ˆ์Šต๋‹ˆ๋‹ค.

1๋‹จ๊ณ„ ํ…Œ์ŠคํŠธ ์ฝ”๋“œ ์ž‘์„ฑ์„ ์ง„ํ–‰ํ•˜๊ธฐ์— ์•ž์„œ์„œ
์ œ๊ฐ€ ํŒŒ์•…ํ•œ ์š”๊ตฌ์‚ฌํ•ญ ์ค‘์— ์ž˜๋ชป๋œ ๋ถ€๋ถ„์ด ์žˆ๋Š”์ง€ ์งš๊ณ  ๋„˜์–ด๊ฐ€๊ณ  ์‹ถ์Šต๋‹ˆ๋‹ค.

ํ™•์ธ ํ›„์— ํ”ผ๋“œ๋ฐฑ ๋ถ€ํƒ๋“œ๋ ค๋„ ๊ดœ์ฐฎ์„๊นŒ์š”??

๋งˆํฌ๋‹ค์šด ๋ฌธ๋ฒ• ์‚ฌ์šฉํ•ด์„œ ํ‘œ(ํ…Œ์ด๋ธ”)๋กœ ์ •๋ฆฌ
Copy link

@geunhwanlee geunhwanlee left a comment

Choose a reason for hiding this comment

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

์š”๊ตฌ์‚ฌํ•ญ ์ž˜ ํŒŒ์•…ํ•ด์ฃผ์…จ์–ด์š”! ๐Ÿ‘๐Ÿป

์†Œ์†Œํ•œ ์ฝ”๋ฉ˜ํŠธ ๋“œ๋ ธ์œผ๋‹ˆ ํ™•์ธํ•ด์ฃผ์‹œ๋ฉด ๊ฐ์‚ฌํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. ๐Ÿ™

ํ…Œ์ŠคํŠธ์ฝ”๋“œ๋ฅผ ์•„์ง ์ž‘์„ฑํ•˜์ง€ ์•Š์œผ์…”์„œ Request changes ์ƒํƒœ๋กœ ๋Œ๋ ค๋†“์„๊ฒŒ์š”.

๊ทธ๋Ÿผ ์ˆ˜์ •ํ›„ ์žฌ ๋ฆฌ๋ทฐ์š”์ฒญ ์ฃผ์„ธ์š”!
ํ™”์ดํŒ…ํ•˜์„ธ์š”. ๐Ÿ”ฅ

README.md Outdated
Comment on lines 15 to 24
### ์ƒํ’ˆ ์ƒ์„ฑํ•˜๊ธฐ (POST /api/products)

- HTTP Response Code : 201 CREATED
- ๊ฐ€๊ฒฉ
- ๊ฐ€๊ฒฉ์€ ๋ฐ˜๋“œ์‹œ ์žˆ์–ด์•ผ ํ•œ๋‹ค
- ๊ฐ€๊ฒฉ์€ 0 ์ด์ƒ์˜ ์ •์ˆ˜์—ฌ์•ผ ํ•œ๋‹ค.

### ์ƒํ’ˆ ๋ฆฌ์ŠคํŠธ ์กฐํšŒ (GET /api/products)

- HTTP Response Code : 200 OK

Choose a reason for hiding this comment

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

Suggested change
### ์ƒํ’ˆ ์ƒ์„ฑํ•˜๊ธฐ (POST /api/products)
- HTTP Response Code : 201 CREATED
- ๊ฐ€๊ฒฉ
- ๊ฐ€๊ฒฉ์€ ๋ฐ˜๋“œ์‹œ ์žˆ์–ด์•ผ ํ•œ๋‹ค
- ๊ฐ€๊ฒฉ์€ 0 ์ด์ƒ์˜ ์ •์ˆ˜์—ฌ์•ผ ํ•œ๋‹ค.
### ์ƒํ’ˆ ๋ฆฌ์ŠคํŠธ ์กฐํšŒ (GET /api/products)
- HTTP Response Code : 200 OK
- `์ƒํ’ˆ`์„ ๋“ฑ๋กํ• ์ˆ˜ ์žˆ๋‹ค
- `์ƒํ’ˆ`์˜ ๊ฐ€๊ฒฉ์€ 0์› ์ด์ƒ์ด์–ด์•ผ ํ•œ๋‹ค
- `์ƒํ’ˆ`์˜ ๋ชฉ๋ก์„ ์กฐํšŒํ• ์ˆ˜ ์žˆ๋‹ค

๊ฐœ๋ฐœ์ž๊ฐ€ ์•„๋‹Œ ์‚ฌ๋žŒ๋“ค๋„ ์ดํ•ดํ• ์ˆ˜ ์žˆ๋Š” ์–ธ์–ด๋กœ ์ž‘์„ฑํ•ด๋ณด๋ฉด ์ข‹์„๊ฒƒ๊ฐ™๋„ค์š”!
์œ„ ์˜ˆ์‹œ๋Š” ์ฐธ๊ณ ๋งŒ ๋ถ€ํƒ๋“œ๋ ค์š” ๐Ÿ™

README.md Outdated
- ๋ฉ”๋‰ด ๊ทธ๋ฃน์ด ์‹ค์ œ๋กœ ์กด์žฌํ•˜์ง€ ์•Š๋Š”๋‹ค๋ฉด ๋ฉ”๋‰ด๋ฅผ ์ƒ์„ฑํ•  ์ˆ˜ ์—†๋‹ค.
- ์ƒํ’ˆ ๋ฆฌ์ŠคํŠธ
- ํ•˜๋‚˜์˜ ์ƒํ’ˆ์ด๋ผ๋„ ์‹ค์ œ๋กœ ์กด์žฌํ•˜์ง€ ์•Š๋Š”๋‹ค๋ฉด ๋ฉ”๋‰ด๋ฅผ ์ƒ์„ฑํ•  ์ˆ˜ ์—†๋‹ค.
- ๋ฉ”๋‰ด์˜ ๊ฐ€๊ฒฉ์€ ํ•ญ์ƒ ๋ชจ๋“  ์ƒํ’ˆ ๊ฐ€๊ฒฉ์˜ ์ดํ•ฉ๋ณด๋‹ค ์ž‘๊ฑฐ๋‚˜ ๊ฐ™์•„์•ผ ํ•œ๋‹ค.

Choose a reason for hiding this comment

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

Suggested change
- ๋ฉ”๋‰ด์˜ ๊ฐ€๊ฒฉ์€ ํ•ญ์ƒ ๋ชจ๋“  ์ƒํ’ˆ ๊ฐ€๊ฒฉ์˜ ์ดํ•ฉ๋ณด๋‹ค ์ž‘๊ฑฐ๋‚˜ ๊ฐ™์•„์•ผ ํ•œ๋‹ค.
- ๋ฉ”๋‰ด์˜ ๊ฐ€๊ฒฉ์€ ๋ชจ๋“  ๋ฉ”๋‰ด ์ƒํ’ˆ์˜ ๊ธˆ์•ก์˜ ํ•ฉ์„ ์ดˆ๊ณผํ• ์ˆ˜ ์—†๋‹ค

์šฉ์–ด์‚ฌ์ „์˜ ์šฉ์–ด๋ฅผ ํ™œ์šฉํ•ด์„œ ์ž‘์„ฑํ•˜๋ฉด ์ข‹์„๊ฒƒ ๊ฐ™๋„ค์š”! ๐Ÿ˜€
๊ทธ๋ฆฌ๊ณ  ๊ฐœ์ธ์ ์œผ๋กœ๋Š” ์ž‘๊ฑฐ๋‚˜ ๊ฐ™๋‹ค๋ณด๋‹ค๋Š” ์ดˆ๊ณผํ• ์ˆ˜ ์—†๋‹ค์™€ ๊ฐ™์ด ํ•œ ๋‹จ์–ด๋กœ ํ‘œํ˜„ํ•˜๋Š”๊ฒŒ ๋‚ซ์ง€ ์•Š์„๊นŒ ์ƒ๊ฐํ•ด์š”.

README.md Outdated
Comment on lines 53 to 63
### ๋ฉ”๋‰ด ์ƒ์„ฑํ•˜๊ธฐ (POST /api/menus)

- HTTP Response Code : 201 CREATED
- ๊ฐ€๊ฒฉ
- ๊ฐ€๊ฒฉ์€ ๋ฐ˜๋“œ์‹œ ์žˆ์–ด์•ผ ํ•œ๋‹ค
- ๊ฐ€๊ฒฉ์€ 0 ์ด์ƒ์˜ ์ •์ˆ˜์—ฌ์•ผ ํ•œ๋‹ค.
- ๋ฉ”๋‰ด ๊ทธ๋ฃน
- ๋ฉ”๋‰ด ๊ทธ๋ฃน์ด ์‹ค์ œ๋กœ ์กด์žฌํ•˜์ง€ ์•Š๋Š”๋‹ค๋ฉด ๋ฉ”๋‰ด๋ฅผ ์ƒ์„ฑํ•  ์ˆ˜ ์—†๋‹ค.
- ์ƒํ’ˆ ๋ฆฌ์ŠคํŠธ
- ํ•˜๋‚˜์˜ ์ƒํ’ˆ์ด๋ผ๋„ ์‹ค์ œ๋กœ ์กด์žฌํ•˜์ง€ ์•Š๋Š”๋‹ค๋ฉด ๋ฉ”๋‰ด๋ฅผ ์ƒ์„ฑํ•  ์ˆ˜ ์—†๋‹ค.
- ๋ฉ”๋‰ด์˜ ๊ฐ€๊ฒฉ์€ ํ•ญ์ƒ ๋ชจ๋“  ์ƒํ’ˆ ๊ฐ€๊ฒฉ์˜ ์ดํ•ฉ๋ณด๋‹ค ์ž‘๊ฑฐ๋‚˜ ๊ฐ™์•„์•ผ ํ•œ๋‹ค.

Choose a reason for hiding this comment

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

๋ฉ”๋‰ด์—๋Š” ์—ฌ๋Ÿฌ ๋ฉ”๋‰ด ์ƒํ’ˆ์„ ๋“ฑ๋กํ• ์ˆ˜ ์žˆ๋‹ค์™€ ๊ฐ™์€ ๋ฌธ๊ตฌ๋ฅผ ์ถ”๊ฐ€ํ•ด๋ณด๋Š”๊ฑด ์–ด๋–จ๊นŒ์š”? ๐Ÿค”

README.md Outdated

- HTTP Response Code : 201 CREATED
- ์ฃผ๋ฌธ ํ•ญ๋ชฉ ๋ฆฌ์ŠคํŠธ
- ์ฃผ๋ฌธ ํ•ญ๋ชฉ์ด ๋ฐ˜๋“œ์‹œ 1 ๊ฐœ ์ด์ƒ์ด์–ด์•ผ ํ•œ๋‹ค.

Choose a reason for hiding this comment

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

Suggested change
- ์ฃผ๋ฌธ ํ•ญ๋ชฉ์ด ๋ฐ˜๋“œ์‹œ 1 ๊ฐœ ์ด์ƒ์ด์–ด์•ผ ํ•œ๋‹ค.
- ์ฃผ๋ฌธ ํ•ญ๋ชฉ์€ ํ•„์ˆ˜์ด๋‹ค

์ด๋ ‡๊ฒŒ ํ‘œํ˜„ํ•˜๋Š”๊ฑด ์–ด๋–ค๊ฐ€์š”? ๐Ÿ˜€

README.md Outdated
Comment on lines 127 to 146
### ์ฃผ๋ฌธ ์ƒ์„ฑํ•˜๊ธฐ (POST /api/orders)

- HTTP Response Code : 201 CREATED
- ์ฃผ๋ฌธ ํ•ญ๋ชฉ ๋ฆฌ์ŠคํŠธ
- ์ฃผ๋ฌธ ํ•ญ๋ชฉ์ด ๋ฐ˜๋“œ์‹œ 1 ๊ฐœ ์ด์ƒ์ด์–ด์•ผ ํ•œ๋‹ค.
- ๋ชจ๋“  ๋ฉ”๋‰ด ์‹ค์ œ๋กœ ํ™•์ธ
- ํ•˜๋‚˜์˜ ๋ฉ”๋‰ด๋ผ๋„ ์‹ค์ œ๋กœ ์กด์žฌํ•˜์ง€ ์•Š๋Š”๋‹ค๋ฉด ์ฃผ๋ฌธ์„ ์ƒ์„ฑํ•  ์ˆ˜ ์—†๋‹ค.
- ์ฃผ๋ฌธ ํ…Œ์ด๋ธ”์ด ์‹ค์ œ๋กœ ์กด์žฌํ•˜์ง€ ์•Š๋Š”๋‹ค๋ฉด ์ฃผ๋ฌธ์„ ์ƒ์„ฑํ•  ์ˆ˜ ์—†๋‹ค.

### ์ฃผ๋ฌธ ๋ฆฌ์ŠคํŠธ ์กฐํšŒํ•˜๊ธฐ (GET /api/orders)

- HTTP Response Code : 200 OK

### ์ฃผ๋ฌธ ์ƒํƒœ ๋ณ€๊ฒฝํ•˜๊ธฐ (PUT /api/orders/{orderId}/order-status)

- HTTP Response Code : 200 OK
- ์ฃผ๋ฌธ ์•„์ด๋””
- ์กด์žฌํ•˜์ง€ ์•Š๋Š” ์ฃผ๋ฌธ์— ๋Œ€ํ•ด์„œ ์ƒํƒœ ๋ณ€๊ฒฝ์„ ์š”์ฒญํ•  ์ˆ˜ ์—†๋‹ค.
- ์ด์ „์˜ ์ฃผ๋ฌธ ์ƒํƒœ
- ์ด์ „์˜ ์ฃผ๋ฌธ ์ƒํƒœ๊ฐ€ "๊ณ„์‚ฐ ์™„๋ฃŒ" ๋ผ๋ฉด ์ƒํƒœ ๋ณ€๊ฒฝ์„ ์š”์ฒญํ•  ์ˆ˜ ์—†๋‹ค.

Choose a reason for hiding this comment

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

์ฃผ๋ฌธํ…Œ์ด๋ธ”์ด ๋นˆ ํ…Œ์ด๋ธ”์ด๋ฉด ์ฃผ๋ฌธํ• ์ˆ˜ ์—†๋‹ค ์ด ๋‚ด์šฉ์ด ๋น ์ง„๊ฒƒ๊ฐ™๋„ค์š”!
๋˜ํ•œ ์ฃผ๋ฌธ ์ƒ์„ฑ์‹œ ์ฃผ๋ฌธ ์ƒํƒœ๊ฐ€ ์กฐ๋ฆฌ์ธ๊ฒƒ๋„ ํ‘œํ˜„ํ•ด์ฃผ๋ฉด ์ข‹์„๊ฒƒ๊ฐ™์•„์š”. ๐Ÿ˜€

README.md Outdated
## ํ…Œ์ด๋ธ” ์ƒ์„ฑ (POST /api/tables)

- HTTP Response Code : 201 CREATED
- ์ƒˆ๋กœ์šด ํ…Œ์ด๋ธ”์„ ์ƒ์„ฑํ•  ๋•Œ ๊ธฐ๋ณธ์ ์œผ๋กœ ํ…Œ์ด๋ธ” ๊ทธ๋ฃน ์•„์ด๋””๋Š” null ๋กœ ์ดˆ๊ธฐํ™”ํ•œ๋‹ค.

Choose a reason for hiding this comment

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

ํ…Œ์ด๋ธ” ๊ทธ๋ฃน ์•„์ด๋””๊ฐ€ null์ด๋ผ๋Š”๊ฑด ์–ด๋–ค ํ‘œํ˜„์œผ๋กœ ๋ฐ”๊ฟ”๋ณผ์ˆ˜ ์žˆ์„๊นŒ์š”? ๐Ÿค”

README.md Outdated
- HTTP Response Code : 200 OK
- ์ฃผ๋ฌธ ํ…Œ์ด๋ธ” ์•„์ด๋””
- ์ฃผ๋ฌธ ํ…Œ์ด๋ธ”์ด ์‹ค์ œ๋กœ ์กด์žฌํ•˜์ง€ ์•Š์œผ๋ฉด ๋นˆ ํ…Œ์ด๋ธ”๋กœ ํ‘œ์‹œํ•  ์ˆ˜ ์—†๋‹ค.
- ์ฃผ๋ฌธ ํ…Œ์ด๋ธ”์ด ํ…Œ์ด๋ธ” ๊ทธ๋ฃน์— ํฌํ•จ๋˜์–ด ์žˆ๋‹ค๋ฉด ๋นˆ ํ…Œ์ด๋ธ”๋กœ ํ‘œ์‹œํ•  ์ˆ˜ ์—†๋‹ค.

Choose a reason for hiding this comment

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

Suggested change
- ์ฃผ๋ฌธ ํ…Œ์ด๋ธ”์ด ํ…Œ์ด๋ธ” ๊ทธ๋ฃน์— ํฌํ•จ๋˜์–ด ์žˆ๋‹ค๋ฉด ๋นˆ ํ…Œ์ด๋ธ”๋กœ ํ‘œ์‹œํ•  ์ˆ˜ ์—†๋‹ค.
- ๋‹จ์ฒด ์ง€์ •๋œ ์ฃผ๋ฌธ ํ…Œ์ด๋ธ”์€ ๋นˆ ํ…Œ์ด๋ธ”๋กœ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์—†๋‹ค.

์ด๋ ‡๊ฒŒ ํ‘œํ˜„ํ•˜๋Š”๊ฑด ์–ด๋–ค๊ฐ€์š”?

@OptimistLabyrinth
Copy link
Author

OptimistLabyrinth commented Dec 13, 2022

์œ„์—์„œ ์ €์˜ ์š”๊ตฌ์‚ฌํ•ญ ๋ถ„์„์— ๋Œ€ํ•ด์„œ ๋ฆฌ๋ทฐํ•ด์ฃผ์‹  ํ”ผ๋“œ๋ฐฑ๋„ ๋ฐ˜์˜ํ–ˆ์Šต๋‹ˆ๋‹ค ใ…Žใ…Ž

๊ทธ๋Ÿฐ๋ฐ
์ œ๊ฐ€ ๋ญ”๊ฐ€๋ฅผ ์ž˜๋ชปํ•˜๊ณ  ์žˆ๋Š”๊ฑธ๊นŒ์š”
์ด๋ ‡๊ฒŒ ๋ชจ๋“ ๊ฑธ ๋ชจํ‚นํ•˜๋Š”๊ฒŒ ๋‹ค์†Œ ๋ฌด์˜๋ฏธํ•˜๊ฒŒ ํƒ€์ดํ•‘ ์—ฐ์Šต๋งŒ ํ•˜๊ณ  ์žˆ๋Š” ๊ฒƒ์ฒ˜๋Ÿผ ๋Š๊ปด์ง€๋Š” ์ด์œ ๊ฐ€ ๋ญ”์ง€ ๋ชจ๋ฅด๊ฒ ์Šต๋‹ˆ๋‹ค ๐Ÿ˜ข

Copy link

@geunhwanlee geunhwanlee left a comment

Choose a reason for hiding this comment

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

1๋‹จ๊ณ„ ํ…Œ์ŠคํŠธ์ฝ”๋“œ ์ž˜ ์ž‘์„ฑํ•ด์ฃผ์…จ์–ด์š”! ๐Ÿ‘๐Ÿป

๋‹ค๋งŒ ๋ช‡๊ฐ€์ง€ ์•„์‰ฌ์šด ์ ์ด ์žˆ์–ด ์ฝ”๋ฉ˜ํŠธ ๋‚จ๊ฒผ์Šต๋‹ˆ๋‹ค. ๐Ÿ˜ญ

๋ชจํ‚น์„ ์‚ฌ์šฉํ•œ ๊ฒฉ๋ฆฌํ…Œ์ŠคํŠธ๋Š”
Service๊ฐ€ ์˜์กดํ•˜๊ณ ์žˆ๋Š” ํ…Œ์ŠคํŠธํ•˜๊ธฐ ์–ด๋ ค์šด ๊ฐ์ฒด๋“ค์„ Mock๊ฐ์ฒด๋กœ ๋ชจํ‚นํ•˜๊ณ 
Service์— ์กด์žฌํ•˜๋Š” ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง์„ ํ…Œ์ŠคํŠธํ•˜๊ธฐ ์œ„ํ•ด ์ž‘์„ฑํ•˜๋Š”๊ฑฐ๋ผ๊ณ  ์ƒ๊ฐํ•ด์š”. ๐Ÿ˜€

๊ทธ๋Ÿฌํ•œ ๋ชฉ์ ์„ ๊ฐ€์ง€๊ณ  ํ…Œ์ŠคํŠธ๋ฅผ ์ž‘์„ฑํ•˜์‹ ๋‹ค๋ฉด ๋ฌด์˜๋ฏธํ•˜๋‹ค๊ณ  ๋Š๋ผ์ง€ ์•Š์„๊ฑฐ๊ฐ™์•„์š” ๐Ÿ‘๐Ÿป

๋‹ค๋งŒ ํ…Œ์ŠคํŠธ๋ฅผ ์ž‘์„ฑํ•˜์‹ค๋•Œ ๊ต‰์žฅํžˆ ๋ณต์žกํ•˜๋‹ค๊ณ  ๋Š๋ผ์…จ์„๊ฒƒ ๊ฐ™์€๋ฐ์š”
๊ทธ๊ฒƒ๊ณผ ๊ด€๊ณ„๋œ(?) ๋‚ด์šฉ์„ ์ฝ”๋ฉ˜ํŠธ๋กœ ๋‚จ๊ฒผ์œผ๋‹ˆ ํ•œ๋ฒˆ ๊ณ ๋ฏผํ•ด๋ณด์‹œ๋ฉด ์ข‹์„๊ฒƒ๊ฐ™์•„์š”!

์ง„ํ–‰ํ•˜๋‹ค ์–ด๋ ค์šด ์ ์ด ์žˆ์œผ์‹œ๋ฉด ์–ธ์ œ๋“  ์—ฐ๋ฝ์ฃผ์„ธ์š”.

๊ทธ๋Ÿผ ํ•œ๋ฒˆ ์‹œ๋„ํ•ด๋ณด์‹œ๊ณ  ์žฌ ๋ฆฌ๋ทฐ์š”์ฒญ ์ฃผ์„ธ์š” ๐Ÿ™
ํ™”์ดํŒ…ํ•˜์„ธ์š”! ๐Ÿ”ฅ

Comment on lines +43 to +45
private MenuGroup setupSuccess(String name) {
final MenuGroup mockMenuGroup = new MenuGroup();
mockMenuGroup.setName("test menu group");

Choose a reason for hiding this comment

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

Suggested change
private MenuGroup setupSuccess(String name) {
final MenuGroup mockMenuGroup = new MenuGroup();
mockMenuGroup.setName("test menu group");
private MenuGroup setupSuccess(String name) {
final MenuGroup mockMenuGroup = new MenuGroup();
mockMenuGroup.setName(name);

๋น ํŠธ๋ฆฌ์‹ ๊ฒƒ ๊ฐ™์•„์š” ๐Ÿ˜€

private MenuGroup setupSuccess(String name) {
final MenuGroup mockMenuGroup = new MenuGroup();
mockMenuGroup.setName("test menu group");
Mockito.when(menuGroupDao.save(Mockito.any())).thenReturn(mockMenuGroup);

Choose a reason for hiding this comment

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

Suggested change
Mockito.when(menuGroupDao.save(Mockito.any())).thenReturn(mockMenuGroup);
BDDMockito.given(menuGroupDao.save(Mockito.any())).willReturn(mockMenuGroup);

BDDMockito๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด given when then ์Šคํƒ€์ผ์— ๋งž๊ฒŒ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์–ด์š” ๐Ÿ˜€

Comment on lines +75 to +77
final Product product = new Product();
product.setId(productId);
product.setPrice(BigDecimal.valueOf(100 * productId));

Choose a reason for hiding this comment

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

Suggested change
final Product product = new Product();
product.setId(productId);
product.setPrice(BigDecimal.valueOf(100 * productId));
final Product product = new Product(productId, BigDecimal.valueOf(100 * productId));

๋„๋ฉ”์ธ ํด๋ž˜์Šค์˜ ์ƒ์„ฑ์ž๋ฅผ ์ˆ˜์ •ํ•˜๋ฉด ๋” ๊ฐ„๋žตํ•˜๊ฒŒ ์ž‘์„ฑํ• ์ˆ˜ ์žˆ๊ฒ ๋„ค์š” ๐Ÿ˜€

Comment on lines +83 to +92
final List<MenuProduct> menuProducts = new ArrayList<>();
for (int i = 0; i < products.size(); ++i) {
final Product product = products.get(i);
final MenuProduct menuProduct = new MenuProduct();
menuProduct.setSeq((long) i + 1);
menuProduct.setMenuId(menuId);
menuProduct.setProductId(product.getId());
menuProduct.setQuantity(product.getId() - 10);
menuProducts.add(menuProduct);
}

Choose a reason for hiding this comment

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

ํ…Œ์ŠคํŠธ ํ”ฝ์Šค์ฒ˜๋ฅผ ๋งŒ๋“œ๋Š”๋ฐ ๋ณต์žกํ•œ ์ฝ”๋“œ๊ฐ€ ๋“ค์–ด๊ฐ€์„œ ๊ฐ€๋…์„ฑ์ด ๋‚ฎ์•„์ง€๋Š”๊ฒƒ๊ฐ™์•„์š”. ๐Ÿ˜ญ
์–ด๋–ป๊ฒŒ ํ•˜๋ฉด ๊ฐ„๋‹จํ•˜๊ฒŒ ํ”ฝ์Šค์ฒ˜๋ฅผ ์ƒ์„ฑํ• ์ˆ˜ ์žˆ์„๊นŒ ๊ณ ๋ฏผํ•ด๋ณด๋ฉด ์ข‹์„๊ฒƒ๊ฐ™์•„์š” ๐Ÿค”

๋งŒ์•ฝ ๊ฐ€๊ฒฉ์— ๋Œ€ํ•œ ํ…Œ์ŠคํŠธ๋ฅผ ํ•œ๋‹ค๋ฉด

MenuGroup ๋ฉ”๋‰ด๊ทธ๋ฃน1 = menuGroupFixture(5000);
Menu = menuFixture(10000, ๋ฉ”๋‰ด๊ทธ๋ฃน1);

์ด๋Ÿฐ์‹์œผ๋กœ ๊ด€์‹ฌ์žˆ๋Š” ๋ฐ์ดํ„ฐ์ธ ๊ฐ€๊ฒฉ๋งŒ ๋“œ๋Ÿฌ๋‚˜๋„๋ก ์ž‘์„ฑํ•˜๋Š”๊ฒƒ๋„ ํ•œ ๋ฐฉ๋ฒ•์ผ๊ฒƒ ๊ฐ™์•„์š” ๐Ÿ˜€

Comment on lines +26 to +27
@WebMvcTest(MenuGroupRestController.class)
public class MenuGroupRestControllerTest {

Choose a reason for hiding this comment

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

Controller์— ๋Œ€ํ•œ ํ…Œ์ŠคํŠธ๋„ ์ž‘์„ฑํ•ด์ฃผ์…จ๋„ค์š” ๐Ÿ‘๐Ÿป

Comment on lines +136 to +142
private Menu setupBadRequestPriceMoreThanSumOfProductPrice() {
final Menu menu = new Menu();
menu.setName("test menu");
menu.setPrice(BigDecimal.valueOf(1500));
Mockito.when(menuRestController.create(Mockito.any())).thenReturn(ResponseEntity.badRequest().build());
return menu;
}

Choose a reason for hiding this comment

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

์ง€์ •ํ•œ ๋ฉ”๋‰ด ๊ฐ€๊ฒฉ์ด ํฌํ•จํ•˜๊ณ  ์žˆ๋Š” ์ƒํ’ˆ์˜ ๊ฐ€๊ฒฉ ์ดํ•ฉ๋ณด๋‹ค ์ปค์„œ ๋ฉ”๋ฅ˜๋ฅผ ๋“ฑ๋กํ•˜์ง€ ๋ชปํ•˜๋ฉด 400 ์ƒํƒœ ์ฝ”๋“œ๋ฅผ ์‘๋‹ต๋ฐ›๋Š”๋‹ค

์œ„ ์กฐ๊ฑด์— ๋งž๊ฒŒ ํ…Œ์ŠคํŠธ๊ฐ€ ๋œ๊ฑธ๊นŒ์š”..? ๐Ÿค”
์กฐ๊ฑด๊ณผ ์ƒ๊ด€์—†์ด bad request๋ฅผ ์‘๋‹ตํ•˜๋Š”๊ฑธ๋กœ ๋ณด์ด๋„ค์š”. ๐Ÿ˜ญ

Comment on lines +188 to +198
@Nested
@DisplayName("๋ฉ”๋‰ด ๊ฐ€๊ฒฉ์ด ํฌํ•จ๋œ ์ƒํ’ˆ์˜ ์ดํ•ฉ๋ณด๋‹ค ํฌ๋ฉด ๋ฉ”๋‰ด ๋“ฑ๋ก ์‹คํŒจ")
public class ErrorMenuPriceExceedsSumOfProductPrice {
@Test
public void testCase() {
// given
final Menu menu = setup();

// when - then
assertThrows(IllegalArgumentException.class, () -> menuService.create(menu));
}

Choose a reason for hiding this comment

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

๋ณต์žกํ•œ ํ”ฝ์Šค์ฒ˜์ƒ์„ฑ์„ setUp() ๋ฉ”์„œ๋“œ๋กœ ๋ถ„๋ฆฌํ•ด๋‚ธ๊ฑด ์ข‹์Šต๋‹ˆ๋‹ค. ๐Ÿ‘๐Ÿป

๋‹ค๋งŒ ๋„ˆ๋ฌด ๋งŽ์€ ํ๋ฆ„์„ setUp์œผ๋กœ ๋ถ„๋ฆฌํ•ด๋ƒˆ๋‹ค๊ณ  ์ƒ๊ฐ์ด ๋“ค์–ด์š”. ๐Ÿค”
๋ฉ”๋‰ด ๊ฐ€๊ฒฉ์ด ํฌํ•จ๋œ ์ƒํ’ˆ์˜ ์ดํ•ฉ๋ณด๋‹ค ํฌ๋ฉด ๋ฉ”๋‰ด ๋“ฑ๋ก ์‹คํŒจ ์กฐ๊ฑด์„ ํ…Œ์ŠคํŠธํ•˜๋Š”๊ฒƒ์ด๊ธฐ ๋•Œ๋ฌธ์—
ํ…Œ์ŠคํŠธ์ฝ”๋“œ์˜ ํ๋ฆ„์„ ๋ณด๊ณ ๋„ ์œ„ ์กฐ๊ฑด์„ ํ…Œ์ŠคํŠธํ•˜๋Š”์ง€ ์‰ฝ๊ฒŒ ์•Œ์ˆ˜ ์žˆ์–ด์•ผํ•ด์š”.

๊ทธ๋ ‡๊ฒŒ ํ•˜๊ธฐ ์œ„ํ•ด์„  ํ…Œ์ŠคํŠธ์˜ ํ๋ฆ„์—์„œ ๊ฐ๊ฐ์˜ ์ƒํ’ˆ์˜ ๊ฐ€๊ฒฉ๊ณผ ๋ฉ”๋‰ด๊ฐ€๊ฒฉ์ด ๋“œ๋Ÿฌ๋‚˜์•ผํ•˜๊ณ 
๋ฉ”๋‰ด๊ฐ€๊ฒฉ์ด ์ƒํ’ˆ๊ฐ€๊ฒฉ์˜ ์ดํ•ฉ๋ณด๋‹ค ํฌ๋‹ค๋Š”๊ฒŒ ๋“œ๋Ÿฌ๋‚˜์•ผํ•ฉ๋‹ˆ๋‹ค.

์–ด๋–ป๊ฒŒ ์ž‘์„ฑํ•ด์•ผํ• ์ง€ ํ•œ๋ฒˆ ๊ณ ๋ฏผํ•ด๋ณด์‹œ๋ฉด ์ข‹์„๊ฒƒ๊ฐ™๋„ค์š” ๐Ÿ˜€

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