-
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.
refactor drivers packages, javadoc, test cases
- added sub packages hrsystemui and scheduleui - specificity in javadocs - new test cases class for ScheduleController
- Loading branch information
1 parent
52608a3
commit 5e5b403
Showing
15 changed files
with
193 additions
and
30 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
3 changes: 2 additions & 1 deletion
3
...ain/java/drivers/DeleteEmployeePanel.java → ...ivers/hrsystemui/DeleteEmployeePanel.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
4 changes: 3 additions & 1 deletion
4
src/main/java/drivers/SchedulePanel.java → ...ava/drivers/scheduleui/SchedulePanel.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
2 changes: 1 addition & 1 deletion
2
src/main/java/drivers/ScheduleUI.java → ...n/java/drivers/scheduleui/ScheduleUI.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package drivers; | ||
package drivers.scheduleui; | ||
|
||
import interfaceadapters.ScheduleController; | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
src/main/java/drivers/ShiftChangePanel.java → .../drivers/scheduleui/ShiftChangePanel.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package drivers; | ||
package drivers.scheduleui; | ||
|
||
import interfaceadapters.ScheduleController; | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
src/main/java/drivers/ShiftChangeScreen.java → ...drivers/scheduleui/ShiftChangeScreen.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package drivers; | ||
package drivers.scheduleui; | ||
|
||
import interfaceadapters.ScheduleController; | ||
|
||
|
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,20 @@ | ||
package interfaceadapters; | ||
|
||
import entities.Employee; | ||
import entities.HRSystem; | ||
import usecases.modifyhrsystem.CreateHRSystem; | ||
|
||
import java.util.ArrayList; | ||
|
||
public class HRSystemController implements CreateHRSystem { | ||
|
||
/** | ||
* createHRSystem | ||
* Creates and returns a new HRSystem. | ||
* @return HRSystem. | ||
*/ | ||
public HRSystem createHRSystem() { | ||
HRSystem hrSystem = new HRSystem(new ArrayList<Employee>()); | ||
return hrSystem; | ||
} | ||
} |
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
2 changes: 1 addition & 1 deletion
2
...cases/modifyemployees/CreateEmployee.java → ...ecases/modifyhrsystem/CreateEmployee.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package usecases.modifyemployees; | ||
package usecases.modifyhrsystem; | ||
|
||
public interface CreateEmployee { | ||
|
||
|
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,16 @@ | ||
package usecases.modifyhrsystem; | ||
|
||
import entities.HRSystem; | ||
|
||
/** | ||
* CreateHRSystem.java | ||
* Interface for use case CreateHRSystem. | ||
*/ | ||
public interface CreateHRSystem { | ||
|
||
/** | ||
* createHRSystem | ||
* Creates a new HRSystem. | ||
*/ | ||
HRSystem createHRSystem(); | ||
} |
2 changes: 1 addition & 1 deletion
2
...cases/modifyemployees/DeleteEmployee.java → ...ecases/modifyhrsystem/DeleteEmployee.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package usecases.modifyemployees; | ||
package usecases.modifyhrsystem; | ||
|
||
public interface DeleteEmployee { | ||
|
||
|
88 changes: 88 additions & 0 deletions
88
src/test/java/interfaceadapters/ScheduleControllerTest.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,88 @@ | ||
package interfaceadapters; | ||
|
||
import drivers.scheduleui.ScheduleUI; | ||
import entities.HRSystem; | ||
import entities.Schedule; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class ScheduleControllerTest { | ||
|
||
HRSystemController hrSystemController = new HRSystemController(); | ||
HRSystem hrSystem = hrSystemController.createHRSystem(); | ||
|
||
ScheduleUI scheduleUI = new ScheduleUI(); | ||
List<String[]> data = ScheduleController.callFileReader(); | ||
ScheduleController scheduleController = new ScheduleController(hrSystem, scheduleUI, data); | ||
Schedule schedule = scheduleController.getSchedule(); | ||
|
||
@Test | ||
public void GetAllEmployeesID() { | ||
ArrayList<String> lst = new ArrayList<>(); | ||
lst.add("001"); | ||
lst.add("002"); | ||
lst.add("003"); | ||
scheduleController.createEmployee("001", "name"); | ||
scheduleController.createEmployee("002", "name"); | ||
scheduleController.createEmployee("003", "name"); | ||
Assertions.assertEquals(lst, scheduleController.getAllEmployeesID()); | ||
} | ||
|
||
@Test | ||
public void AddEmployeeFirstDay() { | ||
scheduleController.addEmployee(schedule, 0, 0, "001"); | ||
Assertions.assertEquals(true, schedule.getShift(0).containsEmployee("001", 0)); | ||
} | ||
|
||
@Test | ||
public void AddEmployeeMiddleDay() { | ||
scheduleController.addEmployee(schedule, 3, 0, "002"); | ||
Assertions.assertEquals(true, schedule.getShift(0).containsEmployee("002", 3)); | ||
} | ||
|
||
@Test | ||
public void AddEmployeeLastDay() { | ||
scheduleController.addEmployee(schedule, 6, 0, "002"); | ||
Assertions.assertEquals(true, schedule.getShift(0).containsEmployee("002", 6)); | ||
} | ||
|
||
@Test | ||
public void RemoveEmployeeStartOfShiftList() { | ||
scheduleController.removeEmployee(schedule, 0, 0, "004"); | ||
Assertions.assertEquals(false, schedule.getShift(0).containsEmployee("004", 0)); | ||
} | ||
|
||
@Test | ||
public void RemoveEmployeeMiddleOfShiftList() { | ||
scheduleController.addEmployee(schedule, 0, 0, "005"); | ||
scheduleController.addEmployee(schedule, 0, 0, "006"); | ||
scheduleController.removeEmployee(schedule, 0, 0, "005"); | ||
Assertions.assertEquals(false, schedule.getShift(0).containsEmployee("005", 0)); | ||
} | ||
|
||
@Test | ||
public void RemoveEmployeeEndOfShiftList() { | ||
scheduleController.addEmployee(schedule, 0, 0, "005"); | ||
scheduleController.addEmployee(schedule, 0, 0, "006"); | ||
scheduleController.removeEmployee(schedule, 0, 0, "006"); | ||
Assertions.assertEquals(false, schedule.getShift(0).containsEmployee("006", 0)); | ||
} | ||
|
||
@Test | ||
public void CreateEmployee() { | ||
scheduleController.createEmployee("001", "name"); | ||
Assertions.assertEquals(true, scheduleController.getAllEmployeesID().contains("001")); | ||
} | ||
|
||
@Test | ||
public void DeleteEmployee() { | ||
scheduleController.createEmployee("006", "name"); | ||
scheduleController.deleteEmployee("006"); | ||
Assertions.assertEquals(false, scheduleController.getAllEmployeesID().contains("006")); | ||
} | ||
} |