Skip to content
Snippets Groups Projects
Commit f8978304 authored by gmantele's avatar gmantele
Browse files

[TAP] Fix the date test in a JUnit file in order to take into account

time shifts (summer/winter time) when any.
parent a5323a89
No related branches found
No related tags found
No related merge requests found
...@@ -94,7 +94,7 @@ public class TestTAPDestructionTimeController { ...@@ -94,7 +94,7 @@ public class TestTAPDestructionTimeController {
// With a destruction interval of 100 minutes: // With a destruction interval of 100 minutes:
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
service.setRetentionPeriod(6000, -1); service.setRetentionPeriod(6000, -1);
calendar.add(Calendar.MINUTE, 100); calendar.add(Calendar.SECOND, 6000); // note: in seconds rather than minutes, in order to take into account the time shift if any
checkDate(calendar.getTime(), controller.getDefault()); checkDate(calendar.getTime(), controller.getDefault());
// With a destruction interval of 100 seconds: // With a destruction interval of 100 seconds:
...@@ -106,7 +106,7 @@ public class TestTAPDestructionTimeController { ...@@ -106,7 +106,7 @@ public class TestTAPDestructionTimeController {
// With a destruction interval of 1 week: // With a destruction interval of 1 week:
service.setRetentionPeriod(7 * 24 * 3600, -1); service.setRetentionPeriod(7 * 24 * 3600, -1);
calendar = Calendar.getInstance(); calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH, 7); calendar.add(Calendar.SECOND, 7 * 24 * 3600); // note: in seconds rather than days, in order to take into account the time shift if any
checkDate(calendar.getTime(), controller.getDefault()); checkDate(calendar.getTime(), controller.getDefault());
} }
...@@ -129,7 +129,7 @@ public class TestTAPDestructionTimeController { ...@@ -129,7 +129,7 @@ public class TestTAPDestructionTimeController {
// With a destruction interval of 100 minutes: // With a destruction interval of 100 minutes:
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
service.setRetentionPeriod(-1, 6000); service.setRetentionPeriod(-1, 6000);
calendar.add(Calendar.MINUTE, 100); calendar.add(Calendar.SECOND, 6000); // note: in seconds rather than minutes, in order to take into account the time shift if any
checkDate(calendar.getTime(), controller.getMaxDestructionTime()); checkDate(calendar.getTime(), controller.getMaxDestructionTime());
// With a destruction interval of 100 seconds: // With a destruction interval of 100 seconds:
...@@ -141,7 +141,7 @@ public class TestTAPDestructionTimeController { ...@@ -141,7 +141,7 @@ public class TestTAPDestructionTimeController {
// With a destruction interval of 1 week: // With a destruction interval of 1 week:
service.setRetentionPeriod(-1, 7 * 24 * 3600); service.setRetentionPeriod(-1, 7 * 24 * 3600);
calendar = Calendar.getInstance(); calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH, 7); calendar.add(Calendar.SECOND, 7 * 24 * 3600); // note: in seconds rather than days, in order to take into account the time shift if any
checkDate(calendar.getTime(), controller.getMaxDestructionTime()); checkDate(calendar.getTime(), controller.getMaxDestructionTime());
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment