-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* change for gitignore * part-1/chapter-1
- Loading branch information
Showing
6 changed files
with
84 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,28 @@ | ||
.gradle | ||
/build/ | ||
!gradle/wrapper/gradle-wrapper.jar | ||
|
||
### STS ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.iml | ||
*.ipr | ||
|
||
### NetBeans ### | ||
nbproject/private/ | ||
build/ | ||
nbbuild/ | ||
dist/ | ||
nbdist/ | ||
.nb-gradle/ | ||
|
||
### ETC ### | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,12 @@ | ||
# TDD | ||
Test-Driven Development | ||
|
||
## ์ฃผ๊ธฐ | ||
1. ์์ ํ ์คํธ๋ฅผ ํ๋ ์ถ๊ฐํ๋ค. | ||
2. ๋ชจ๋ ํ ์คํธ๋ฅผ ์คํํด์ ํ ์คํธ๊ฐ ์คํจํ๋ ๊ฒ์ ํ์ธํ๋ค. | ||
3. ์กฐ๊ธ ์์ ํ๋ค. | ||
4. ๋ชจ๋ ํ ์คํธ๋ฅผ ์คํํด์ ํ ์คํธ๊ฐ ์ฑ๊ณตํ๋ ๊ฒ์ ํ์ธํ๋ค. | ||
5. ์ค๋ณต์ ์ ๊ฑฐํ๊ธฐ ์ํด ๋ฆฌํฉํ ๋ง์ ํ๋ค. | ||
|
||
## ETC | ||
- [์์กด์ฑ๊ณผ ์ค๋ณต](./etc/dependency_and_duplication.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# ์์กด์ฑ๊ณผ ์ค๋ณต | ||
|
||
์คํฐ๋ธ ํ๋ฆฌ๋ง(Steve Freeman)์ ํ ์คํธ์ ์ฝ๋ ๊ฐ์ ๋ฌธ์ ๋ ์ค๋ณต์ด ์๋์ ์ง์ ํ ๋ฐ ์๋ค(์ค๋ณต์ ๋ํด์๋ ์์ง ์ด์ผ๊ธฐํ์ง ์์์ง๋ง, ์ด ์ฌ๋ด์ด ๋๋๋ ๋๋ก ์ธ๊ธํ ์๊ฐ์ด๋ค). ๋ฌธ์ ๋ ํ ์คํธ์ ์ฝ๋ ์ฌ์ด์ ์กด์ฌํ๋ ์์กด์ฑ์ด๋ค. ์ฆ ์ฝ๋๋ ํ ์คํธ ์ค ํ์ชฝ์ ์์ ํ๋ฉด ๋ฐ๋์ ๋ค๋ฅธ ํ์ชฝ๋ ์์ ํด์ผ๋ง ํ๋ค๋ ๊ฒ์ด๋ค. ์ฐ๋ฆฌ์ ๋ชฉํ๋ ์ฝ๋๋ฅผ ๋ฐ๊พธ์ง ์์ผ๋ฉด์๋ ๋ญ๊ฐ ์๋ฏธ ์๋ ํ ์คํธ๋ฅผ ํ๋ ๋ ์์ฑํ๋ ๊ฒ์ธ๋ฐ, ํ์ฌ์ ๊ตฌํ์ผ๋ก๋ ๋ถ๊ฐ๋ฅํ๋ค.<br/> | ||
|
||
### ์์กด์ฑ(Dependency) | ||
|
||
์์กด์ฑ์ ์ํํธ์จ์ด ๊ฐ๋ฐ์ ๋ชจ๋ ๋ถ๋ถ์์ ํต์ฌ์ ์ธ ๋ฌธ์ ๋ค. ๋ง์ฝ ํน์ ๋ฐ์ดํฐ๋ฒ ์ด์ค ๋ฒค๋๊ฐ ์ ๊ณตํ๋ ์ธ์ธํ ๊ธฐ๋ฅ๋ค์ ์ฝ๋ ์ฌ๊ธฐ์ ๊ธฐ์์ ์ฌ์ฉํ๋ ์ํฉ์์ ๋ฐ์ดํฐ๋ฒ ์ด์ค๋ฅผ ๋ค๋ฅธ ๋ฒค๋์ ์ ํ์ผ๋ก ๋ณ๊ฒฝํ๊ณ ์ ํ๋ค๋ฉด ์ฝ๋๊ฐ ํด๋น ๋ฒค๋์ ๋ํด ์์กด์ฑ์ ๊ฐ๋๋ค๋ ์ฌ์ค์ ์๊ฒ ๋ ๊ฒ์ด๋ค. ์ฝ๋๋ฅผ ๋ณ๊ฒฝํ์ง ์๊ณ ๋ ๋ฒค๋๋ฅผ ๋ฐ๊ฟ ์ ์๋ค. | ||
|
||
### ์ค๋ณต(Duplication) | ||
|
||
์์กด์ฑ์ด ๋ฌธ์ ๊ทธ ์์ฒด๋ผ๋ฉด ์ค๋ณต์ ๋ฌธ์ ์ ์งํ๋ค. ์ค๋ณต์ ๊ฐ์ฅ ํํ ์๋ ๋ก์ง์ ์ค๋ณต์ด๋ค. ์ค๋ณต๋ ๋ก์ง์ด๋ ๋์ผํ ๋ฌธ์ฅ์ด ์ฝ๋์ ์ฌ๋ฌ ์ฅ์์ ๋ํ๋๋ ๊ฒ์ ์๋ฏธํ๋ค. ์ค๋ณต๋ ๋ก์ง์ ํ๋๋ก ๋์ง์ด๋ด๋ ์ผ์ ๊ฐ์ฒด๋ฅผ ์ด์ฉํ๋ ๊ฒ์ด ์ต๊ณ ๋ค. | ||
|
||
### ... | ||
|
||
๋ฌธ์ ์์ฒด๋ ๋จ๊ฒจ๋ ์ฑ๋ก ์งํ๋ง์ ์ ๊ฑฐํ๋ฉด ๋ค๋ฅธ ์ด๋๊ฐ์์ ์ต์ ์ ํํ๋ก ๋ฌธ์ ๊ฐ ๋๋ฌ๋๊ณค ํ๋ ํ์ค ์ธ๊ณ์ ์ผ๋ฐ์ ์ธ ์์๊ณผ๋ ๋ฌ๋ฆฌ, ํ๋ก๊ทธ๋จ์์๋ ์ค๋ณต๋ง ์ ๊ฑฐํด ์ฃผ๋ฉด ์์กด์ฑ๋ ์ ๊ฑฐ๋๋ค. ์ด๊ฒ ๋ฐ๋ก TDD์ ๋ ๋ฒ์งธ ๊ท์น์ด ์กด์ฌํ๋ ์ด์ ๋ค. ๋ค์ ํ ์คํธ๋ก ์งํํ๊ธฐ ์ ์ ์ค๋ณต์ ์ ๊ฑฐํจ์ผ๋ก์จ, ์ค์ง ํ ๊ฐ์ง(one and only one)์ ์ฝ๋ ์์ ์ ํตํด ๋ค์ ํ ์คํธ๋ ํต๊ณผ๋๊ฒ ๋ง๋ค ๊ฐ๋ฅ์ฑ์ ์ต๋ํํ๋ ๊ฒ์ด๋ค. |
14 changes: 14 additions & 0 deletions
14
test_driven_development_by_example/src/main/java/com/tdd/test/money/Dollar.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.tdd.test.money; | ||
|
||
public class Dollar { | ||
|
||
public int amount; | ||
|
||
public Dollar(int amount) { | ||
this.amount = amount; | ||
} | ||
|
||
public void times(int multipler) { | ||
amount *= multipler; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
test_driven_development_by_example/src/test/java/com/tdd/test/money/MoneyTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.tdd.test.money; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class MoneyTests { | ||
|
||
@Test | ||
public void testMultiplication() { | ||
Dollar five = new Dollar(5); | ||
five.times(2); | ||
assertEquals(10, five.amount); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters