Skip to content
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

remove unnecessary dynamic test behaviour #112

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/test/java/data/EntryArithmeticTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@

public class EntryArithmeticTest {

private static LocalDate DATE_NOW = LocalDate.now();
private static final LocalDate DATE = LocalDate.of(2020, 5, 17);

@Test
public void testGetWorkingTime1() {
TimeSpan start = new TimeSpan(14, 0);
TimeSpan end = new TimeSpan(18, 0);
TimeSpan pause = new TimeSpan(0, 30);
Entry entry = new Entry("Test", DATE_NOW, start, end, pause, false);
Entry entry = new Entry("Test", DATE, start, end, pause, false);

TimeSpan workingTime = entry.getWorkingTime();
assertEquals(workingTime.getHour(), 3);
Expand All @@ -27,7 +27,7 @@ public void testGetWorkingTime2() {
TimeSpan start = new TimeSpan(17, 0);
TimeSpan end = new TimeSpan(20, 30);
TimeSpan pause = new TimeSpan(0, 0);
Entry entry = new Entry("Test", DATE_NOW, start, end, pause, false);
Entry entry = new Entry("Test", DATE, start, end, pause, false);

TimeSpan workingTime = entry.getWorkingTime();
assertEquals(workingTime.getHour(), 3);
Expand All @@ -39,7 +39,7 @@ public void testGetWorkingTime3() {
TimeSpan start = new TimeSpan(12, 30);
TimeSpan end = new TimeSpan(21, 0);
TimeSpan pause = new TimeSpan(0, 30);
Entry entry = new Entry("Test", DATE_NOW, start, end, pause, false);
Entry entry = new Entry("Test", DATE, start, end, pause, false);

TimeSpan workingTime = entry.getWorkingTime();
assertEquals(workingTime.getHour(), 8);
Expand All @@ -51,7 +51,7 @@ public void testGetWorkingTime4() {
TimeSpan start = new TimeSpan(13, 0);
TimeSpan end = new TimeSpan(21, 25);
TimeSpan pause = new TimeSpan(0, 30);
Entry entry = new Entry("Test", DATE_NOW, start, end, pause, false);
Entry entry = new Entry("Test", DATE, start, end, pause, false);

TimeSpan workingTime = entry.getWorkingTime();
assertEquals(workingTime.getHour(), 7);
Expand All @@ -63,7 +63,7 @@ public void testGetWorkingTime5() {
TimeSpan start = new TimeSpan(19, 30);
TimeSpan end = new TimeSpan(20, 0);
TimeSpan pause = new TimeSpan(0, 0);
Entry entry = new Entry("Test", DATE_NOW, start, end, pause, false);
Entry entry = new Entry("Test", DATE, start, end, pause, false);

TimeSpan workingTime = entry.getWorkingTime();
assertEquals(workingTime.getHour(), 0);
Expand All @@ -75,7 +75,7 @@ public void testGetWorkingTime6() {
TimeSpan start = new TimeSpan(13, 0);
TimeSpan end = new TimeSpan(23, 0);
TimeSpan pause = new TimeSpan(5, 0);
Entry entry = new Entry("Test", DATE_NOW, start, end, pause, false);
Entry entry = new Entry("Test", DATE, start, end, pause, false);

TimeSpan workingTime = entry.getWorkingTime();
assertEquals(workingTime.getHour(), 5);
Expand All @@ -87,7 +87,7 @@ public void testGetWorkingTimeVacation() {
TimeSpan start = new TimeSpan(9, 0);
TimeSpan end = new TimeSpan(12, 0);
TimeSpan pause = new TimeSpan(0, 0);
Entry entry = new Entry("Test", DATE_NOW, start, end, pause, true);
Entry entry = new Entry("Test", DATE, start, end, pause, true);

TimeSpan workingTime = entry.getWorkingTime();
assertEquals(workingTime.getHour(), 3);
Expand Down
24 changes: 13 additions & 11 deletions src/test/java/data/TimeSheetArithmeticTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,21 @@

public class TimeSheetArithmeticTest {

private static final LocalDate DATE = LocalDate.of(2020, 5, 17);

@Test
public void testGetTotalWorkTime() {
Employee employee = new Employee("Moritz Gstür", 1234567);
Profession profession = new Profession("Fakultät für Informatik", WorkingArea.UB, new TimeSpan(40, 0), 10.31);
TimeSpan zeroTs = new TimeSpan(0, 0);
Entry[] entries = new Entry[7];
entries[0] = new Entry("Test1", LocalDate.now(), new TimeSpan(10, 0), new TimeSpan(18, 30), new TimeSpan(3, 15), false);
entries[1] = new Entry("Test2", LocalDate.now(), new TimeSpan(12, 0), new TimeSpan(16, 30), new TimeSpan(0, 0), false);
entries[2] = new Entry("Test3", LocalDate.now(), new TimeSpan(10, 0), new TimeSpan(12, 0), new TimeSpan(0, 15), false);
entries[3] = new Entry("Test4", LocalDate.now(), new TimeSpan(15, 0), new TimeSpan(16, 30), new TimeSpan(0, 0), false);
entries[4] = new Entry("Test5", LocalDate.now(), new TimeSpan(20, 0), new TimeSpan(20, 30), new TimeSpan(0, 0), false);
entries[5] = new Entry("Test6", LocalDate.now(), new TimeSpan(9, 30), new TimeSpan(18, 30), new TimeSpan(1, 0), false);
entries[6] = new Entry("Test7", LocalDate.now(), new TimeSpan(9, 0), new TimeSpan(12, 0), new TimeSpan(0, 0), true);
entries[0] = new Entry("Test1", DATE, new TimeSpan(10, 0), new TimeSpan(18, 30), new TimeSpan(3, 15), false);
entries[1] = new Entry("Test2", DATE, new TimeSpan(12, 0), new TimeSpan(16, 30), new TimeSpan(0, 0), false);
entries[2] = new Entry("Test3", DATE, new TimeSpan(10, 0), new TimeSpan(12, 0), new TimeSpan(0, 15), false);
entries[3] = new Entry("Test4", DATE, new TimeSpan(15, 0), new TimeSpan(16, 30), new TimeSpan(0, 0), false);
entries[4] = new Entry("Test5", DATE, new TimeSpan(20, 0), new TimeSpan(20, 30), new TimeSpan(0, 0), false);
entries[5] = new Entry("Test6", DATE, new TimeSpan(9, 30), new TimeSpan(18, 30), new TimeSpan(1, 0), false);
entries[6] = new Entry("Test7", DATE, new TimeSpan(9, 0), new TimeSpan(12, 0), new TimeSpan(0, 0), true);
TimeSheet timeSheet = new TimeSheet(employee, profession, YearMonth.of(2019, Month.NOVEMBER), entries, zeroTs, zeroTs);

assertEquals(timeSheet.getTotalWorkTime(), new TimeSpan(21, 30));
Expand All @@ -34,10 +36,10 @@ public void testGetTotalVacationTime() {
Profession profession = new Profession("Fakultät für Informatik", WorkingArea.UB, new TimeSpan(40, 0), 10.31);
TimeSpan zeroTs = new TimeSpan(0, 0);
Entry[] entries = new Entry[4];
entries[0] = new Entry("Test1", LocalDate.now(), new TimeSpan(10, 0), new TimeSpan(18, 30), new TimeSpan(3, 15), false);
entries[1] = new Entry("Test2", LocalDate.now(), new TimeSpan(12, 0), new TimeSpan(16, 30), new TimeSpan(0, 0), true);
entries[2] = new Entry("Test3", LocalDate.now(), new TimeSpan(10, 0), new TimeSpan(12, 0), new TimeSpan(0, 0), true);
entries[3] = new Entry("Test4", LocalDate.now(), new TimeSpan(15, 0), new TimeSpan(16, 30), new TimeSpan(0, 0), true);
entries[0] = new Entry("Test1", DATE, new TimeSpan(10, 0), new TimeSpan(18, 30), new TimeSpan(3, 15), false);
entries[1] = new Entry("Test2", DATE, new TimeSpan(12, 0), new TimeSpan(16, 30), new TimeSpan(0, 0), true);
entries[2] = new Entry("Test3", DATE, new TimeSpan(10, 0), new TimeSpan(12, 0), new TimeSpan(0, 0), true);
entries[3] = new Entry("Test4", DATE, new TimeSpan(15, 0), new TimeSpan(16, 30), new TimeSpan(0, 0), true);
TimeSheet timeSheet = new TimeSheet(employee, profession, YearMonth.of(2019, Month.NOVEMBER), entries, zeroTs, zeroTs);

assertEquals(timeSheet.getTotalVacationTime(), new TimeSpan(8, 0));
Expand Down