TSK-1224: add/refactor tests

This commit is contained in:
sfrevel 2020-05-12 08:14:55 +02:00
parent d7562b53a3
commit 6e3ac9cc5c
4 changed files with 34 additions and 20 deletions

View File

@ -569,8 +569,8 @@ public class TaskanaEngineConfiguration {
}
throw new WrongCustomHolidayFormatException(
String.format(
"Wrong format fpr custom holiday entry %s! The format should be 'dd.MM' "
+ "i.e. 01.05 for the first of may.",
"Wrong format for custom holiday entry %s! The format should be 'dd.MM' "
+ "i.e. 01.05 for the first of may. The value will be ignored!",
customHolidayEntry));
}

View File

@ -4,24 +4,7 @@ public class WrongCustomHolidayFormatException extends Exception {
private static final long serialVersionUID = -7644923780787018797L;
public WrongCustomHolidayFormatException() {
super();
}
public WrongCustomHolidayFormatException(
String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
public WrongCustomHolidayFormatException(String message, Throwable cause) {
super(message, cause);
}
public WrongCustomHolidayFormatException(String message) {
super(message);
}
public WrongCustomHolidayFormatException(Throwable cause) {
super(cause);
}
}

View File

@ -25,7 +25,8 @@ class TaskanaEngineTestConfigurationTest {
}
@Test
void testCustomHolidayInitialisationWithTaskanaProprtiesFile() throws SQLException {
void should_returnTheTwoCustomHolidays_When_twoCustomHolidaysAreConfiguredInThePropertiesFile()
throws SQLException {
DataSource ds = TaskanaEngineTestConfiguration.getDataSource();
TaskanaEngineConfiguration taskEngineConfiguration =
new TaskanaEngineConfiguration(
@ -38,4 +39,19 @@ class TaskanaEngineTestConfigurationTest {
assertThat(taskEngineConfiguration.getCustomHolidays()).contains(CustomHoliday.of(31, 7));
assertThat(taskEngineConfiguration.getCustomHolidays()).contains(CustomHoliday.of(16, 12));
}
@Test
void should_returnEmptyCustomHolidaysList_When_allCustomHolidaysAreInWrongFormatInPropertiesFile()
throws SQLException {
DataSource ds = TaskanaEngineTestConfiguration.getDataSource();
TaskanaEngineConfiguration taskEngineConfiguration =
new TaskanaEngineConfiguration(
ds,
false,
false,
"/custom_holiday_With_Wrong_format_taskana.properties",
"|",
TaskanaEngineTestConfiguration.getSchemaName());
assertThat(taskEngineConfiguration.getCustomHolidays()).isEmpty();
}
}

View File

@ -0,0 +1,15 @@
taskana.roles.user=group1 | group2|teamlead_1 | teamlead_2 |user_1_1| user_1_1| user_1_2| user_2_1| user_2_2| max|elena|simone
taskana.roles.Admin=name=konrad,Organisation=novatec|admin
taskana.roles.businessadmin=max|Moritz|businessadmin
taskana.roles.monitor=john|teamlead_2 | monitor
taskana.domains=Domain_A , DOMAIN_B
taskana.classification.types=TASK , document
taskana.classification.categories.task=EXTERNAL, manual, autoMAtic, Process
taskana.classification.categories.document=EXTERNAL
taskana.jobs.maxRetries=3
taskana.jobs.batchSize=50
taskana.jobs.cleanup.runEvery=P1D
taskana.jobs.cleanup.firstRunAt=2018-07-25T08:00:00Z
taskana.jobs.cleanup.minimumAge=P14D
taskana.german.holidays.enabled=true
taskana.custom.holidays=31,07;1612