Skip to content

Commit 7e411d4

Browse files
TSK-1252: fixed newly introduced code smells
1 parent ab6e5ec commit 7e411d4

File tree

8 files changed

+28
-32
lines changed

8 files changed

+28
-32
lines changed

lib/taskana-core/src/main/java/pro/taskana/task/internal/ServiceLevelHandler.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -313,16 +313,16 @@ private Instant getFollowingWorkingDays(Instant instant, Duration days) {
313313
*/
314314
private void ensureServiceLevelIsNotViolated(
315315
TaskImpl task, Duration duration, Instant calcPlanned) throws InvalidArgumentException {
316-
if (task.getPlanned() != null && !task.getPlanned().equals(calcPlanned)) {
317-
// manual entered planned date is a different working day than computed value
318-
if (converter.isWorkingDay(0, task.getPlanned())
319-
|| converter.hasWorkingDaysInBetween(task.getPlanned(), calcPlanned)) {
320-
throw new InvalidArgumentException(
321-
String.format(
322-
"Cannot update a task with given planned %s "
323-
+ "and due date %s not matching the service level %s.",
324-
task.getPlanned(), task.getDue(), duration));
325-
}
316+
if (task.getPlanned() != null
317+
&& !task.getPlanned().equals(calcPlanned)
318+
// manual entered planned date is a different working day than computed value
319+
&& (converter.isWorkingDay(0, task.getPlanned())
320+
|| converter.hasWorkingDaysInBetween(task.getPlanned(), calcPlanned))) {
321+
throw new InvalidArgumentException(
322+
String.format(
323+
"Cannot update a task with given planned %s "
324+
+ "and due date %s not matching the service level %s.",
325+
task.getPlanned(), task.getDue(), duration));
326326
}
327327
}
328328

lib/taskana-core/src/test/java/acceptance/config/TaskanaSecurityConfigAccTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
import pro.taskana.common.internal.configuration.DbSchemaCreator;
2020
import pro.taskana.sampledata.SampleDataGenerator;
2121

22-
public class TaskanaSecurityConfigAccTest {
22+
class TaskanaSecurityConfigAccTest {
2323

2424
@BeforeEach
25-
public void cleanDb() throws SQLException {
25+
void cleanDb() throws SQLException {
2626
DataSource dataSource = TaskanaEngineTestConfiguration.getDataSource();
2727
String schemaName = TaskanaEngineTestConfiguration.getSchemaName();
2828

@@ -33,7 +33,7 @@ public void cleanDb() throws SQLException {
3333
}
3434

3535
@Test
36-
public void should_ThrowException_When_CreatingUnsecuredEngineCfgWhileSecurityIsEnforced()
36+
void should_ThrowException_When_CreatingUnsecuredEngineCfgWhileSecurityIsEnforced()
3737
throws SQLException {
3838

3939
setSecurityFlag(true);
@@ -54,7 +54,7 @@ public void should_ThrowException_When_CreatingUnsecuredEngineCfgWhileSecurityIs
5454
}
5555

5656
@Test
57-
public void should_StartUpNormally_When_CreatingUnsecuredEngineCfgWhileSecurityIsNotEnforced()
57+
void should_StartUpNormally_When_CreatingUnsecuredEngineCfgWhileSecurityIsNotEnforced()
5858
throws SQLException {
5959

6060
setSecurityFlag(false);
@@ -73,7 +73,7 @@ public void should_StartUpNormally_When_CreatingUnsecuredEngineCfgWhileSecurityI
7373
}
7474

7575
@Test
76-
public void should_SetSecurityFlagToFalse_When_CreatingUnsecureEngineCfgAndSecurityFlagIsNotSet()
76+
void should_SetSecurityFlagToFalse_When_CreatingUnsecureEngineCfgAndSecurityFlagIsNotSet()
7777
throws SQLException {
7878

7979
assertThat(retrieveSecurityFlag()).isNull();
@@ -94,7 +94,7 @@ public void should_SetSecurityFlagToFalse_When_CreatingUnsecureEngineCfgAndSecur
9494
}
9595

9696
@Test
97-
public void should_SetSecurityFlagToTrue_When_CreatingSecureEngineCfgAndSecurityFlagIsNotSet()
97+
void should_SetSecurityFlagToTrue_When_CreatingSecureEngineCfgAndSecurityFlagIsNotSet()
9898
throws SQLException {
9999

100100
assertThat(retrieveSecurityFlag()).isNull();

lib/taskana-core/src/test/java/acceptance/workbasket/CreateWorkbasketAuthorizationsAccTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
/** Acceptance test for all "set workbasket access item" scenarios. */
1717
@ExtendWith(JaasExtension.class)
18-
public class CreateWorkbasketAuthorizationsAccTest extends AbstractAccTest {
18+
class CreateWorkbasketAuthorizationsAccTest extends AbstractAccTest {
1919

2020
@WithAccessId(user = "user_1_1")
2121
@WithAccessId(user = "taskadmin")

lib/taskana-core/src/test/java/acceptance/workbasket/DeleteWorkbasketAuthorizationsAccTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414

1515
/** Acceptance test for all "delete workbasket authorizations" scenarios. */
1616
@ExtendWith(JaasExtension.class)
17-
public class DeleteWorkbasketAuthorizationsAccTest extends AbstractAccTest {
17+
class DeleteWorkbasketAuthorizationsAccTest extends AbstractAccTest {
1818

1919
@WithAccessId(user = "user_1_1")
2020
@WithAccessId(user = "taskadmin")
2121
@TestTemplate
22-
public void should_ThrowException_When_UserRoleIsNotAdminOrBusinessAdmin() {
22+
void should_ThrowException_When_UserRoleIsNotAdminOrBusinessAdmin() {
2323

2424
final WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
2525

lib/taskana-core/src/test/java/acceptance/workbasket/GetWorkbasketAuthorizationsAccTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414

1515
/** Acceptance test for all "get workbasket authorizations" scenarios. */
1616
@ExtendWith(JaasExtension.class)
17-
public class GetWorkbasketAuthorizationsAccTest extends AbstractAccTest {
17+
class GetWorkbasketAuthorizationsAccTest extends AbstractAccTest {
1818

1919
@WithAccessId(user = "user_1_1")
2020
@WithAccessId(user = "taskadmin")
2121
@TestTemplate
22-
public void should_ThrowException_When_UserRoleIsNotAdminOrBusinessAdmin() {
22+
void should_ThrowException_When_UserRoleIsNotAdminOrBusinessAdmin() {
2323

2424
final WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
2525

lib/taskana-core/src/test/java/acceptance/workbasket/UpdateWorkbasketAccTest.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,13 @@
2323

2424
/** Acceptance test for all "update workbasket" scenarios. */
2525
@ExtendWith(JaasExtension.class)
26-
public class UpdateWorkbasketAccTest extends AbstractAccTest {
27-
28-
public UpdateWorkbasketAccTest() {
29-
super();
30-
}
26+
class UpdateWorkbasketAccTest extends AbstractAccTest {
3127

3228
@WithAccessId(
3329
user = "teamlead_1",
3430
groups = {"group_1", "businessadmin"})
3531
@Test
36-
public void testUpdateWorkbasket()
32+
void testUpdateWorkbasket()
3733
throws NotAuthorizedException, WorkbasketNotFoundException, ConcurrencyException {
3834
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
3935
Workbasket workbasket = workbasketService.getWorkbasket("GPK_KSC", "DOMAIN_A");
@@ -67,7 +63,7 @@ public void testUpdateWorkbasket()
6763
user = "teamlead_1",
6864
groups = {"group_1", "businessadmin"})
6965
@Test
70-
public void testUpdateWorkbasketWithConcurrentModificationShouldThrowException()
66+
void testUpdateWorkbasketWithConcurrentModificationShouldThrowException()
7167
throws NotAuthorizedException, WorkbasketNotFoundException, ConcurrencyException {
7268

7369
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@@ -85,7 +81,7 @@ public void testUpdateWorkbasketWithConcurrentModificationShouldThrowException()
8581
user = "teamlead_1",
8682
groups = {"group_1", "businessadmin"})
8783
@Test
88-
public void testUpdateWorkbasketOfNonExistingWorkbasketShouldThrowException()
84+
void testUpdateWorkbasketOfNonExistingWorkbasketShouldThrowException()
8985
throws NotAuthorizedException, WorkbasketNotFoundException, ConcurrencyException {
9086

9187
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@@ -103,7 +99,7 @@ public void testUpdateWorkbasketOfNonExistingWorkbasketShouldThrowException()
10399
@WithAccessId(user = "user_1_1", groups = "group_1")
104100
@WithAccessId(user = "taskadmin")
105101
@TestTemplate
106-
public void should_ThrowException_When_UserRoleIsNotAdminOrBusinessAdmin()
102+
void should_ThrowException_When_UserRoleIsNotAdminOrBusinessAdmin()
107103
throws NotAuthorizedException, WorkbasketNotFoundException {
108104
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
109105
Workbasket workbasket = workbasketService.getWorkbasket("USER_1_1", "DOMAIN_A");

lib/taskana-core/src/test/java/acceptance/workbasket/UpdateWorkbasketAuthorizationsAccTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class UpdateWorkbasketAuthorizationsAccTest extends AbstractAccTest {
4040
@WithAccessId(user = "user_1_1")
4141
@WithAccessId(user = "taskadmin")
4242
@TestTemplate
43-
public void should_ThrowException_When_UserIsNotAdminOrBusinessAdmin() {
43+
void should_ThrowException_When_UserIsNotAdminOrBusinessAdmin() {
4444

4545
final WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
4646

lib/taskana-core/src/test/java/pro/taskana/common/internal/security/JaasExtensionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import org.junit.jupiter.api.extension.ExtendWith;
2525

2626
@ExtendWith(JaasExtension.class)
27-
public class JaasExtensionTest {
27+
class JaasExtensionTest {
2828

2929
private static final String INSIDE_DYNAMIC_TEST_USER = "insidedynamictest";
3030
private static final DynamicTest NOT_NULL_DYNAMIC_TEST =

0 commit comments

Comments
 (0)