forked from gilbutITbook/006814
-
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.
- Loading branch information
gilbut
committed
Apr 24, 2019
0 parents
commit cb47455
Showing
2,422 changed files
with
92,132 additions
and
0 deletions.
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
/.metadata/ |
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,4 @@ | ||
# 자바와 JUnit을 활용한 실용주의 단위 테스트(길벗, 2019) | ||
|
||
- 이 책의 모든 예제 코드는 자바 8을 기준으로 합니다. | ||
- 일부 예제 코드는 일부러 오류가 발생하도록 작성된 것도 있습니다. |
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,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
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,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>iloveyouboss_1</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
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,11 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=1.8 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.8 |
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,24 @@ | ||
/*** | ||
* Excerpted from "Pragmatic Unit Testing in Java with JUnit", | ||
* published by The Pragmatic Bookshelf. | ||
* Copyrights apply to this code. It may not be used to create training material, | ||
* courses, books, articles, and the like. Contact us if you are in doubt. | ||
* We make no guarantees that this code is fit for any purpose. | ||
* Visit http://www.pragmaticprogrammer.com/titles/utj2 for more book information. | ||
***/ | ||
package iloveyouboss; | ||
|
||
import java.util.*; | ||
|
||
public class ScoreCollection { | ||
private List<Scoreable> scores = new ArrayList<>(); | ||
|
||
public void add(Scoreable scoreable) { | ||
scores.add(scoreable); | ||
} | ||
|
||
public int arithmeticMean() { | ||
int total = scores.stream().mapToInt(Scoreable::getScore).sum(); | ||
return total / scores.size(); | ||
} | ||
} |
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 @@ | ||
/*** | ||
* Excerpted from "Pragmatic Unit Testing in Java with JUnit", | ||
* published by The Pragmatic Bookshelf. | ||
* Copyrights apply to this code. It may not be used to create training material, | ||
* courses, books, articles, and the like. Contact us if you are in doubt. | ||
* We make no guarantees that this code is fit for any purpose. | ||
* Visit http://www.pragmaticprogrammer.com/titles/utj2 for more book information. | ||
***/ | ||
package iloveyouboss; | ||
|
||
@FunctionalInterface | ||
public interface Scoreable { | ||
int getScore(); | ||
} |
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,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="src" path="test"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
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,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>iloveyouboss_2</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
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,11 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=1.8 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.8 |
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,24 @@ | ||
/*** | ||
* Excerpted from "Pragmatic Unit Testing in Java with JUnit", | ||
* published by The Pragmatic Bookshelf. | ||
* Copyrights apply to this code. It may not be used to create training material, | ||
* courses, books, articles, and the like. Contact us if you are in doubt. | ||
* We make no guarantees that this code is fit for any purpose. | ||
* Visit http://www.pragmaticprogrammer.com/titles/utj2 for more book information. | ||
***/ | ||
package iloveyouboss; | ||
|
||
import java.util.*; | ||
|
||
public class ScoreCollection { | ||
private List<Scoreable> scores = new ArrayList<>(); | ||
|
||
public void add(Scoreable scoreable) { | ||
scores.add(scoreable); | ||
} | ||
|
||
public int arithmeticMean() { | ||
int total = scores.stream().mapToInt(Scoreable::getScore).sum(); | ||
return total / scores.size(); | ||
} | ||
} |
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 @@ | ||
/*** | ||
* Excerpted from "Pragmatic Unit Testing in Java with JUnit", | ||
* published by The Pragmatic Bookshelf. | ||
* Copyrights apply to this code. It may not be used to create training material, | ||
* courses, books, articles, and the like. Contact us if you are in doubt. | ||
* We make no guarantees that this code is fit for any purpose. | ||
* Visit http://www.pragmaticprogrammer.com/titles/utj2 for more book information. | ||
***/ | ||
package iloveyouboss; | ||
|
||
@FunctionalInterface | ||
public interface Scoreable { | ||
int getScore(); | ||
} |
21 changes: 21 additions & 0 deletions
21
iloveyouboss_02/test/iloveyouboss/ScoreCollectionTest.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,21 @@ | ||
/*** | ||
* Excerpted from "Pragmatic Unit Testing in Java with JUnit", | ||
* published by The Pragmatic Bookshelf. | ||
* Copyrights apply to this code. It may not be used to create training material, | ||
* courses, books, articles, and the like. Contact us if you are in doubt. | ||
* We make no guarantees that this code is fit for any purpose. | ||
* Visit http://www.pragmaticprogrammer.com/titles/utj2 for more book information. | ||
***/ | ||
package iloveyouboss; | ||
|
||
import static org.junit.Assert.*; //(1) | ||
import org.junit.*; //(2) | ||
|
||
public class ScoreCollectionTest { //(3) | ||
|
||
@Test //(4) | ||
public void test() { //(5) | ||
fail("Not yet implemented"); //(6) | ||
} | ||
|
||
} |
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,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="src" path="test"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
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,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>iloveyouboss_3</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
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,11 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=1.8 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.8 |
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,24 @@ | ||
/*** | ||
* Excerpted from "Pragmatic Unit Testing in Java with JUnit", | ||
* published by The Pragmatic Bookshelf. | ||
* Copyrights apply to this code. It may not be used to create training material, | ||
* courses, books, articles, and the like. Contact us if you are in doubt. | ||
* We make no guarantees that this code is fit for any purpose. | ||
* Visit http://www.pragmaticprogrammer.com/titles/utj2 for more book information. | ||
***/ | ||
package iloveyouboss; | ||
|
||
import java.util.*; | ||
|
||
public class ScoreCollection { | ||
private List<Scoreable> scores = new ArrayList<>(); | ||
|
||
public void add(Scoreable scoreable) { | ||
scores.add(scoreable); | ||
} | ||
|
||
public int arithmeticMean() { | ||
int total = scores.stream().mapToInt(Scoreable::getScore).sum(); | ||
return total / scores.size(); | ||
} | ||
} |
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 @@ | ||
/*** | ||
* Excerpted from "Pragmatic Unit Testing in Java with JUnit", | ||
* published by The Pragmatic Bookshelf. | ||
* Copyrights apply to this code. It may not be used to create training material, | ||
* courses, books, articles, and the like. Contact us if you are in doubt. | ||
* We make no guarantees that this code is fit for any purpose. | ||
* Visit http://www.pragmaticprogrammer.com/titles/utj2 for more book information. | ||
***/ | ||
package iloveyouboss; | ||
|
||
@FunctionalInterface | ||
public interface Scoreable { | ||
int getScore(); | ||
} |
18 changes: 18 additions & 0 deletions
18
iloveyouboss_03/test/iloveyouboss/ScoreCollectionTest.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,18 @@ | ||
/*** | ||
* Excerpted from "Pragmatic Unit Testing in Java with JUnit", | ||
* published by The Pragmatic Bookshelf. | ||
* Copyrights apply to this code. It may not be used to create training material, | ||
* courses, books, articles, and the like. Contact us if you are in doubt. | ||
* We make no guarantees that this code is fit for any purpose. | ||
* Visit http://www.pragmaticprogrammer.com/titles/utj2 for more book information. | ||
***/ | ||
package iloveyouboss; | ||
|
||
import static org.junit.Assert.*; | ||
import org.junit.*; | ||
|
||
public class ScoreCollectionTest { | ||
@Test | ||
public void test() { | ||
} | ||
} |
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,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="src" path="test"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
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,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>iloveyouboss_4</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
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,11 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=1.8 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.8 |
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,24 @@ | ||
/*** | ||
* Excerpted from "Pragmatic Unit Testing in Java with JUnit", | ||
* published by The Pragmatic Bookshelf. | ||
* Copyrights apply to this code. It may not be used to create training material, | ||
* courses, books, articles, and the like. Contact us if you are in doubt. | ||
* We make no guarantees that this code is fit for any purpose. | ||
* Visit http://www.pragmaticprogrammer.com/titles/utj2 for more book information. | ||
***/ | ||
package iloveyouboss; | ||
|
||
import java.util.*; | ||
|
||
public class ScoreCollection { | ||
private List<Scoreable> scores = new ArrayList<>(); | ||
|
||
public void add(Scoreable scoreable) { | ||
scores.add(scoreable); | ||
} | ||
|
||
public int arithmeticMean() { | ||
int total = scores.stream().mapToInt(Scoreable::getScore).sum(); | ||
return total / scores.size(); | ||
} | ||
} |
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 @@ | ||
/*** | ||
* Excerpted from "Pragmatic Unit Testing in Java with JUnit", | ||
* published by The Pragmatic Bookshelf. | ||
* Copyrights apply to this code. It may not be used to create training material, | ||
* courses, books, articles, and the like. Contact us if you are in doubt. | ||
* We make no guarantees that this code is fit for any purpose. | ||
* Visit http://www.pragmaticprogrammer.com/titles/utj2 for more book information. | ||
***/ | ||
package iloveyouboss; | ||
|
||
@FunctionalInterface | ||
public interface Scoreable { | ||
int getScore(); | ||
} |
29 changes: 29 additions & 0 deletions
29
iloveyouboss_04/test/iloveyouboss/ScoreCollectionTest.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,29 @@ | ||
/*** | ||
* Excerpted from "Pragmatic Unit Testing in Java with JUnit", | ||
* published by The Pragmatic Bookshelf. | ||
* Copyrights apply to this code. It may not be used to create training material, | ||
* courses, books, articles, and the like. Contact us if you are in doubt. | ||
* We make no guarantees that this code is fit for any purpose. | ||
* Visit http://www.pragmaticprogrammer.com/titles/utj2 for more book information. | ||
***/ | ||
package iloveyouboss; | ||
|
||
import static org.junit.Assert.*; | ||
import static org.hamcrest.CoreMatchers.*; | ||
import org.junit.*; | ||
|
||
public class ScoreCollectionTest { | ||
@Test | ||
public void answersArithmeticMeanOfTwoNumbers() { | ||
// Arrange | ||
ScoreCollection collection = new ScoreCollection(); | ||
collection.add(() -> 5); | ||
collection.add(() -> 7); | ||
|
||
// Act | ||
int actualResult = collection.arithmeticMean(); | ||
|
||
// Assert | ||
assertThat(actualResult, equalTo(6)); | ||
} | ||
} |
Oops, something went wrong.