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

๐Ÿš€ 3๋‹จ๊ณ„ - ์ง€ํ•˜์ฒ  ๊ตฌ๊ฐ„ ๊ด€๋ฆฌ #938

Open
wants to merge 4 commits into
base: jwoo-o
Choose a base branch
from

Conversation

jwoo-o
Copy link

@jwoo-o jwoo-o commented Jul 11, 2023

์•ˆ๋…•ํ•˜์„ธ์š” step3 ์ง€ํ•˜์ฒ ๋…ธ์„  ๊ตฌ๊ฐ„ ์ถ”๊ฐ€,์‚ญ์ œ ๊ธฐ๋Šฅ pr์˜ฌ๋ฆฝ๋‹ˆ๋‹ค.

line ๋„๋ฉ”์ธ์— Sections์ด๋ผ๋Š” ์ผ๊ธ‰์ปฌ๋ ‰์…˜์œผ๋กœ ๋„๋ฉ”์ธ ๊ธฐ๋Šฅ์„ ๋ถ„๋ฆฌํ•˜์—ฌ ๋“ฑ๋ก,์‚ญ์ œ๋ฅผ ์ฒ˜๋ฆฌํ•˜์˜€์Šต๋‹ˆ๋‹ค.

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.

์•ˆ๋…•ํ•˜์„ธ์š” ์ง„์šฐ๋‹˜ ๐Ÿ˜ƒ
Step ํด๋ž˜์Šค๋ฅผ ๋ถ„๋ฆฌํ•˜๋ฉด์„œ ์ธ์ˆ˜ ์กฐ๊ฑด๊ณผ ์ธ์ˆ˜ ํ…Œ์ŠคํŠธ์˜ ๊ฐ€๋…์„ฑ์ด ์ข‹์•„์ง„ ๊ฒƒ ๊ฐ™์•„์š” ๐Ÿ‘
๊ด€๋ จํ•ด์„œ ๋ช‡ ๊ฐ€์ง€ ์ฝ”๋ฉ˜ํŠธ ๋‚จ๊ฒจ๋‘์—ˆ๋Š”๋ฐ ํ™•์ธํ•ด ์ฃผ์„ธ์š”

Comment on lines +16 to +20
@Embeddable
public class Sections {

@OneToMany(mappedBy = "line", orphanRemoval = true, cascade = CascadeType.ALL)
private List<Section> sections;
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 +34 to +37
List<Station> stations = sections.stream()
.map(Section::getUpStation)
.collect(Collectors.toList());
setLastStations(stations);
Copy link
Member

Choose a reason for hiding this comment

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

stream์˜ flatMap ๋ฉ”์„œ๋“œ๋ฅผ ํ™œ์šฉํ•ด ๋ณด์…”๋„ ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š” ๐Ÿ˜ƒ

Comment on lines +58 to +60
public void addSection(Section section) {
this.sections.addSection(section);
}
Copy link
Member

Choose a reason for hiding this comment

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

addSection ๋ฉ”์„œ๋“œ๋ฅผ ์ˆ˜ํ–‰ํ•˜๋Š” line ๊ฐ์ฒด์™€
์ธ์ž๋กœ ๋ฐ›์€ Section ๋‚ด๋ถ€์˜ line ํ•„๋“œ๊ฐ€ ์„œ๋กœ ๋‹ค๋ฅด๋ฉด ์–ด๋–ป๊ฒŒ ๋ ๊นŒ์š”?
์ธ์ž๋กœ ๋ฐ›์€ Section์˜ line์„ ์žฌํ• ๋‹นํ•˜๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์€๋ฐ ์ง„์šฐ๋‹˜ ์ƒ๊ฐ์€ ์–ด๋– ์‹ ๊ฐ€์š”?
section.setLine(this);

//then
assertThat(lines).hasSize(2);
assertThat(lines).containsExactly(์‹ ๋ถ„๋‹น์„ .get("name"), ๋ถ„๋‹น์„ .get("name"));
LineStep.์ง€ํ•˜์ฒ ๋…ธ์„ ์„_ํ™•์ธ(Arrays.asList(์‹ ๋ถ„๋‹น์„ , ๋ถ„๋‹น์„ ));
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 +135 to +139
/**
* Given ์ง€ํ•˜์ฒ ์—ญ ๋ฐ ์ง€ํ•˜์ฒ  ๋…ธ์„ ์„ ์ƒ์„ฑํ•˜๊ณ  ์ง€ํ•˜์ฒ  ๊ตฌ๊ฐ„์„ ์ถ”๊ฐ€ํ•˜๊ณ 
* When ์ƒˆ๋กœ์šด ๊ตฌ๊ฐ„์„ ์—ฐ์žฅํ•˜๋ฉด
* Then ํ•ด๋‹น ์ง€ํ•˜์ฒ  ๋…ธ์„ ์˜ ์—ฐ์žฅ๋œ ๊ตฌ๊ฐ„์˜ ์ •๋ณด๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.
*/
Copy link
Member

Choose a reason for hiding this comment

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

์กฐ๊ฑด์ด 2๊ฐœ ์ด์ƒ์ด๋ฉด Given์„ 2๊ฐœ ์จ๋„ ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š” ๐Ÿ˜ƒ

Suggested change
/**
* Given ์ง€ํ•˜์ฒ ์—ญ ๋ฐ ์ง€ํ•˜์ฒ  ๋…ธ์„ ์„ ์ƒ์„ฑํ•˜๊ณ  ์ง€ํ•˜์ฒ  ๊ตฌ๊ฐ„์„ ์ถ”๊ฐ€ํ•˜๊ณ 
* When ์ƒˆ๋กœ์šด ๊ตฌ๊ฐ„์„ ์—ฐ์žฅํ•˜๋ฉด
* Then ํ•ด๋‹น ์ง€ํ•˜์ฒ  ๋…ธ์„ ์˜ ์—ฐ์žฅ๋œ ๊ตฌ๊ฐ„์˜ ์ •๋ณด๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.
*/
/**
* Given ์ง€ํ•˜์ฒ ์—ญ ๋ฐ ์ง€ํ•˜์ฒ  ๋…ธ์„ ์„ ์ƒ์„ฑํ•˜๊ณ 
* Given ์ง€ํ•˜์ฒ  ๊ตฌ๊ฐ„์„ ์ถ”๊ฐ€ํ•˜๊ณ 
* When ์ƒˆ๋กœ์šด ๊ตฌ๊ฐ„์„ ์—ฐ์žฅํ•˜๋ฉด
* Then ํ•ด๋‹น ์ง€ํ•˜์ฒ  ๋…ธ์„ ์˜ ์—ฐ์žฅ๋œ ๊ตฌ๊ฐ„์˜ ์ •๋ณด๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.
*/

Comment on lines +154 to +158
/**
* Given ์ง€ํ•˜์ฒ ์—ญ ๋ฐ ์ง€ํ•˜์ฒ  ๋…ธ์„ ์„ ์ƒ์„ฑํ•˜๊ณ  ์ง€ํ•˜์ฒ  ๊ตฌ๊ฐ„์„ ์ถ”๊ฐ€ํ•˜๊ณ 
* When ์ƒˆ๋กœ์šด ๊ตฌ๊ฐ„์„ ๋“ฑ๋กํ•  ๋•Œ
* Then ์ƒˆ๋กœ์šด ๊ตฌ๊ฐ„์˜ ์ƒํ–‰์—ญ์€ ํ•ด๋‹น ๋…ธ์„ ์— ๋“ฑ๋ก๋˜์–ด์žˆ๋Š” ํ•˜ํ–‰ ์ข…์ ์—ญ์ด ์•„๋‹๊ฒฝ์šฐ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค
*/
Copy link
Member

Choose a reason for hiding this comment

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

ํ…Œ์ŠคํŠธ ์ฝ”๋“œ์˜ when ์ ˆ๊ณผ ์ธ์ˆ˜ ์กฐ๊ฑด ์ฃผ์„์˜ when์„ ์ผ์น˜ ์‹œํ‚ค๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์€๋ฐ ์ง„์šฐ๋‹˜ ์ƒ๊ฐ์€ ์–ด๋– ์‹ ๊ฐ€์š”?

Suggested change
/**
* Given ์ง€ํ•˜์ฒ ์—ญ ๋ฐ ์ง€ํ•˜์ฒ  ๋…ธ์„ ์„ ์ƒ์„ฑํ•˜๊ณ  ์ง€ํ•˜์ฒ  ๊ตฌ๊ฐ„์„ ์ถ”๊ฐ€ํ•˜๊ณ 
* When ์ƒˆ๋กœ์šด ๊ตฌ๊ฐ„์„ ๋“ฑ๋กํ•  ๋•Œ
* Then ์ƒˆ๋กœ์šด ๊ตฌ๊ฐ„์˜ ์ƒํ–‰์—ญ์€ ํ•ด๋‹น ๋…ธ์„ ์— ๋“ฑ๋ก๋˜์–ด์žˆ๋Š” ํ•˜ํ–‰ ์ข…์ ์—ญ์ด ์•„๋‹๊ฒฝ์šฐ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค
*/
/**
* Given ์ง€ํ•˜์ฒ ์—ญ ๋ฐ ์ง€ํ•˜์ฒ  ๋…ธ์„ ์„ ์ƒ์„ฑํ•˜๊ณ  ์ง€ํ•˜์ฒ  ๊ตฌ๊ฐ„์„ ์ถ”๊ฐ€ํ•˜๊ณ 
* When ์ƒˆ๋กœ์šด ๊ตฌ๊ฐ„์˜ ์ƒํ–‰์—ญ์€ ํ•ด๋‹น ๋…ธ์„ ์— ๋“ฑ๋ก๋˜์–ด์žˆ๋Š” ํ•˜ํ–‰ ์ข…์ ์—ญ์ด ์•„๋‹Œ ๊ตฌ๊ฐ„์„ ์ถ”๊ฐ€ํ•˜๋ฉด
* Then ๊ตฌ๊ฐ„ ๋“ฑ๋ก์— ์‹คํŒจํ•œ๋‹ค
*/

Comment on lines +192 to +196
/**
* Given ์ง€ํ•˜์ฒ ์—ญ ๋ฐ ์ง€ํ•˜์ฒ  ๋…ธ์„ ์„ ์ƒ์„ฑ, ์ง€ํ•˜์ฒ  ๊ตฌ๊ฐ„์„ 2๊ฐœ๋ฅผ ์ถ”๊ฐ€ ํ•˜๊ณ 
* When ๊ตฌ๊ฐ„์„ ์ถ•์†Œ ํ•  ๊ฒฝ์šฐ
* Then ํ•ด๋‹น ๊ตฌ๊ฐ„์€ ์‚ญ์ œ๊ฐ€ ๋œ๋‹ค.
*/
Copy link
Member

Choose a reason for hiding this comment

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

์ธ์ˆ˜ ์กฐ๊ฑด์—์„œ ์‚ฌ์šฉํ•˜์‹  ์—ฐ์žฅ, ์ถ•์†Œ๋ผ๋Š” ํ‘œํ˜„์ด ์ธ์ƒ์ ์ด๋„ค์š” ๐Ÿ‘ ๐Ÿ‘

import java.util.List;
import java.util.Map;

public class LineStep {
Copy link
Member

Choose a reason for hiding this comment

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

Step ํด๋ž˜์Šค ๋ถ„๋ฆฌ ๐Ÿ’ฏ

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