-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
84846c6
commit c460305
Showing
21 changed files
with
277 additions
and
20 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
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
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,2 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.apt.aptEnabled=false |
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
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 @@ | ||
activeProfiles= | ||
eclipse.preferences.version=1 | ||
resolveWorkspaceProjects=true | ||
version=1 |
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,35 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.example</groupId> | ||
<artifactId>hr-domain</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-all</artifactId> | ||
<version>1.10.19</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-engine</artifactId> | ||
<version>5.5.2</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<sourceDirectory>src</sourceDirectory> | ||
<testSourceDirectory>test</testSourceDirectory> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.8.1</version> | ||
<configuration> | ||
<release>11</release> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
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
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
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,5 @@ | ||
Manifest-Version: 1.0 | ||
Built-By: dcl | ||
Build-Jdk: 11.0.7 | ||
Created-By: Maven Integration for Eclipse | ||
|
7 changes: 7 additions & 0 deletions
7
hr-domain/target/classes/META-INF/maven/com.example/hr-domain/pom.properties
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,7 @@ | ||
#Generated by Maven Integration for Eclipse | ||
#Tue Jun 23 17:09:21 EET 2020 | ||
m2e.projectLocation=C\:\\DEVEL\\stage\\tmp\\dcl350\\hr-domain | ||
m2e.projectName=hr-domain | ||
groupId=com.example | ||
artifactId=hr-domain | ||
version=0.0.1-SNAPSHOT |
35 changes: 35 additions & 0 deletions
35
hr-domain/target/classes/META-INF/maven/com.example/hr-domain/pom.xml
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,35 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.example</groupId> | ||
<artifactId>hr-domain</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-all</artifactId> | ||
<version>1.10.19</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-engine</artifactId> | ||
<version>5.5.2</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<sourceDirectory>src</sourceDirectory> | ||
<testSourceDirectory>test</testSourceDirectory> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.8.1</version> | ||
<configuration> | ||
<release>11</release> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
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,5 @@ | ||
#Generated by Maven | ||
#Tue Jun 23 17:09:29 EET 2020 | ||
groupId=com.example | ||
artifactId=hr-domain | ||
version=0.0.1-SNAPSHOT |
Empty file.
17 changes: 17 additions & 0 deletions
17
hr-domain/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
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 @@ | ||
C:\DEVEL\stage\tmp\dcl350\hr-domain\src\com\example\hr\domain\BirthYear.java | ||
C:\DEVEL\stage\tmp\dcl350\hr-domain\src\com\example\hr\infrastructure\EventPushlisher.java | ||
C:\DEVEL\stage\tmp\dcl350\hr-domain\src\com\example\hr\events\EmployeeHiredEvent.java | ||
C:\DEVEL\stage\tmp\dcl350\hr-domain\src\com\example\hr\application\business\SimpleEmployeeApplication.java | ||
C:\DEVEL\stage\tmp\dcl350\hr-domain\src\com\example\hr\domain\TcKimlikNoRecord.java | ||
C:\DEVEL\stage\tmp\dcl350\hr-domain\src\com\example\hr\events\BusinessEvent.java | ||
C:\DEVEL\stage\tmp\dcl350\hr-domain\src\com\example\hr\domain\FullName.java | ||
C:\DEVEL\stage\tmp\dcl350\hr-domain\src\com\example\hr\domain\Iban.java | ||
C:\DEVEL\stage\tmp\dcl350\hr-domain\src\com\example\hr\application\EmployeeApplication.java | ||
C:\DEVEL\stage\tmp\dcl350\hr-domain\src\com\example\hr\domain\Department.java | ||
C:\DEVEL\stage\tmp\dcl350\hr-domain\src\com\example\hr\domain\TcKimlikNo.java | ||
C:\DEVEL\stage\tmp\dcl350\hr-domain\src\com\example\hr\domain\MoneyCurrency.java | ||
C:\DEVEL\stage\tmp\dcl350\hr-domain\src\com\example\hr\repository\EmployeeRepository.java | ||
C:\DEVEL\stage\tmp\dcl350\hr-domain\src\com\example\hr\domain\Employee.java | ||
C:\DEVEL\stage\tmp\dcl350\hr-domain\src\com\example\hr\domain\Photo.java | ||
C:\DEVEL\stage\tmp\dcl350\hr-domain\src\com\example\hr\domain\Money.java | ||
C:\DEVEL\stage\tmp\dcl350\hr-domain\src\com\example\hr\events\EmployeeFiredEvent.java |
Empty file.
1 change: 1 addition & 0 deletions
1
.../target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
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 @@ | ||
C:\DEVEL\stage\tmp\dcl350\hr-domain\test\com\example\hr\application\business\SimpleEmployeeApplicationTest.java |
53 changes: 53 additions & 0 deletions
53
hr-domain/test/com/example/hr/application/business/SimpleEmployeeApplicationTest.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,53 @@ | ||
package com.example.hr.application.business; | ||
|
||
import static org.junit.Assert.assertTrue; | ||
|
||
import java.util.Optional; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.mockito.Mockito; | ||
|
||
import com.example.hr.domain.Department; | ||
import com.example.hr.domain.Employee; | ||
import com.example.hr.domain.MoneyCurrency; | ||
import com.example.hr.domain.TcKimlikNo; | ||
import com.example.hr.events.EmployeeHiredEvent; | ||
import com.example.hr.infrastructure.EventPushlisher; | ||
import com.example.hr.repository.EmployeeRepository; | ||
|
||
class SimpleEmployeeApplicationTest { | ||
|
||
// Unit Testing -> Test Doubles | ||
// 1. Dummy Object | ||
// 2. Stub Object -> Partial Implementation -> Real Object | ||
// 3. Fake Object -> Simple/Full Implementation (HashMap - in-memory implementation) | ||
// 4. Mock Object -> Mocking/Spying Library -> Mockito | ||
// 5. Spy Object | ||
@Test | ||
void hireEmployee_success() { | ||
// 1. test setup / fixture | ||
SimpleEmployeeApplication app = new SimpleEmployeeApplication(); | ||
EmployeeRepository empRepo = Mockito.mock(EmployeeRepository.class); | ||
EventPushlisher eventPublisher = Mockito.mock(EventPushlisher.class); | ||
app.setEmployeeRepository(empRepo); | ||
app.setEventPushlisher(eventPublisher); | ||
System.out.println(empRepo.getClass()); | ||
Employee jack = new Employee.Builder("40310900232") | ||
.fullname("jack", "bauer") | ||
.birthYear(1956) | ||
.salary(100_000, MoneyCurrency.USD) | ||
.iban("TR820006235455781668847562") | ||
.fulltime(true) | ||
.department(Department.IT) | ||
.photo("iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAABC1BMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADXsw3hAAAAWXRSTlMAWQFYVwIlVUpSTypIR0wSKBFFAw9WCRo/OgUvQjMNIR5EBhBOLiIZExRTCjsdDlBBHD1UQwc4Sx8wQC0kKxtGBAwsPDEnMhU0N00gOSlJNSYjURY+CxcINmo6xHsAAATwSURBVHhe7Ztnbxs5EIbfGXK16l22VSwXufcax70kju30enf//5ccJDsXCPJyaK3I4BA/XwQLEN6Hs/SSw5Xwf+IZZnSZ7YwnmncTM8l0KtSKSIepuWyr/qa4vvQ3ujCzk3gAaE/dlr9SJCvZ99fLjZ6Di/jCcU5TD9WFegy+kV6bWh21AwMXX8oPSWTgQSPcWa8APML4RibdSycbehJvM/ujUmDgZHMgXXZYuWqAeRTxSzkiTU9FE21OxS9CADQN8ZLC0VhMA0Y7S6RoSBSF07GKwJjWwvDFIkwOb8DAqTB8GUUzswiGzT+k+GhKtxEMlz9JaiQGu6VhDOR8e4Nw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zzeyf/r2D8DgcGUKmeLSQWzjoVAOw/f/HFHN2Tfj8OsO/4XN+vaz6e+VRg4FM3vO/LlS/YmwGDW//F/1IoB74MGK9IP7Ipn/BWgIVe/qBBwlMJgrcRfcHmhZ8CLEb2xtt+WsOriCNSTYd+BD51BeTGwP/5iKJ/wL+zNdRU9COwQVGUwN7uQ4NoOvLVmFxqUo+dkPpqTBjrRGow/53H1Wi6bzG8/2PK63rcOX+I/fmSLYDhDwbendMvcsIBuRMDlD6sfUztppKvMgUMnf/Mv8NIVU+cyYl6AAAAAElFTkSuQmCC".getBytes()) | ||
.build(); | ||
Mockito.doNothing().when(empRepo).save(jack); | ||
Mockito.doNothing().when(eventPublisher).publishEvent(new EmployeeHiredEvent("", "employees", jack) ); | ||
// 2. call exercise method | ||
var success = app.hireEmployee(jack); | ||
// 3. Verification | ||
assertTrue(success); | ||
// 4. destroy setup | ||
} | ||
|
||
} |
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
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
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
Oops, something went wrong.