-
Notifications
You must be signed in to change notification settings - Fork 90
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주차 과제 - Spring 테스트 작성하기 #83
Changes from all commits
d3341a1
77d34df
9fb83c8
b357afb
30e07c6
45263d4
4caf49c
5c8484e
8aebc01
3503251
3089b94
9815368
7d25cc2
7fd1735
8e03669
23c6e66
d7cdfba
9c7d9e6
4a9d718
b86f1b5
8138d60
f4ae790
067bf9b
a8f92e7
c12316e
ad0b279
28f14e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,4 @@ Thumbs.db | |
Thumbs.db:encryptable | ||
ehthumbs.db | ||
ehthumbs_vista.db | ||
/app/out/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,20 @@ | ||
package com.codesoom.assignment.models; | ||
|
||
import java.util.Objects; | ||
|
||
public class Task { | ||
private Long id; | ||
|
||
private String title; | ||
|
||
public Task() { | ||
} | ||
|
||
public Task(Long id, String title) { | ||
this.id = id; | ||
this.title = title; | ||
} | ||
|
||
public Long getId() { | ||
return id; | ||
} | ||
|
@@ -20,4 +30,28 @@ public String getTitle() { | |
public void setTitle(String title) { | ||
this.title = title; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) | ||
return true; | ||
if (o == null || this.getClass() != o.getClass()) | ||
return false; | ||
Task task = (Task) o; | ||
return Objects.equals(this.id, task.getId()) && this.title.equals(task.getTitle()); | ||
} | ||
Comment on lines
+35
to
+42
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. 좋습니다! 다만 이와 관련된 유명하고 재미있는 버그 이야기가 있습니다. Apple의 SSL/TLS 프로토콜에서 발견된 끔찍한 실수입니다. 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. 이런 일이 있었군요 ㅎㅎ 감사합니다 !! |
||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(id, title); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
final StringBuilder sb = new StringBuilder("Task{"); | ||
sb.append("id=").append(id); | ||
sb.append(", title='").append(title).append('\''); | ||
sb.append('}'); | ||
return sb.toString(); | ||
Comment on lines
+51
to
+55
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. String.format을 사용해서 표현하는 건 어떨까요? 다음과 같이 표현할 수 있을거에요 return String.format("{ id = %s, title = %s }", id, title); 더 좋은건 Template literal이지만 자바에서는 지원하질 않네요 ㅠ 만약 이런게 지원하는 코틀린을 사용했다면 다음과 같이 사용할 수 있을거에요 return "{ id = $id, title = $title }" |
||
} | ||
} |
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.
ArrayList를 사용하게 된 김에 DynamicArray 자료구조에 대해 학습해보는 것도 좋을 것 같습니다.