TSK-1252: fixed newly introduced code smells
This commit is contained in:
parent
ab6e5ecc33
commit
7e411d42e1
|
@ -313,16 +313,16 @@ class ServiceLevelHandler {
|
|||
*/
|
||||
private void ensureServiceLevelIsNotViolated(
|
||||
TaskImpl task, Duration duration, Instant calcPlanned) throws InvalidArgumentException {
|
||||
if (task.getPlanned() != null && !task.getPlanned().equals(calcPlanned)) {
|
||||
// manual entered planned date is a different working day than computed value
|
||||
if (converter.isWorkingDay(0, task.getPlanned())
|
||||
|| converter.hasWorkingDaysInBetween(task.getPlanned(), calcPlanned)) {
|
||||
throw new InvalidArgumentException(
|
||||
String.format(
|
||||
"Cannot update a task with given planned %s "
|
||||
+ "and due date %s not matching the service level %s.",
|
||||
task.getPlanned(), task.getDue(), duration));
|
||||
}
|
||||
if (task.getPlanned() != null
|
||||
&& !task.getPlanned().equals(calcPlanned)
|
||||
// manual entered planned date is a different working day than computed value
|
||||
&& (converter.isWorkingDay(0, task.getPlanned())
|
||||
|| converter.hasWorkingDaysInBetween(task.getPlanned(), calcPlanned))) {
|
||||
throw new InvalidArgumentException(
|
||||
String.format(
|
||||
"Cannot update a task with given planned %s "
|
||||
+ "and due date %s not matching the service level %s.",
|
||||
task.getPlanned(), task.getDue(), duration));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,10 +19,10 @@ import pro.taskana.common.internal.TaskanaEngineTestConfiguration;
|
|||
import pro.taskana.common.internal.configuration.DbSchemaCreator;
|
||||
import pro.taskana.sampledata.SampleDataGenerator;
|
||||
|
||||
public class TaskanaSecurityConfigAccTest {
|
||||
class TaskanaSecurityConfigAccTest {
|
||||
|
||||
@BeforeEach
|
||||
public void cleanDb() throws SQLException {
|
||||
void cleanDb() throws SQLException {
|
||||
DataSource dataSource = TaskanaEngineTestConfiguration.getDataSource();
|
||||
String schemaName = TaskanaEngineTestConfiguration.getSchemaName();
|
||||
|
||||
|
@ -33,7 +33,7 @@ public class TaskanaSecurityConfigAccTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void should_ThrowException_When_CreatingUnsecuredEngineCfgWhileSecurityIsEnforced()
|
||||
void should_ThrowException_When_CreatingUnsecuredEngineCfgWhileSecurityIsEnforced()
|
||||
throws SQLException {
|
||||
|
||||
setSecurityFlag(true);
|
||||
|
@ -54,7 +54,7 @@ public class TaskanaSecurityConfigAccTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void should_StartUpNormally_When_CreatingUnsecuredEngineCfgWhileSecurityIsNotEnforced()
|
||||
void should_StartUpNormally_When_CreatingUnsecuredEngineCfgWhileSecurityIsNotEnforced()
|
||||
throws SQLException {
|
||||
|
||||
setSecurityFlag(false);
|
||||
|
@ -73,7 +73,7 @@ public class TaskanaSecurityConfigAccTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void should_SetSecurityFlagToFalse_When_CreatingUnsecureEngineCfgAndSecurityFlagIsNotSet()
|
||||
void should_SetSecurityFlagToFalse_When_CreatingUnsecureEngineCfgAndSecurityFlagIsNotSet()
|
||||
throws SQLException {
|
||||
|
||||
assertThat(retrieveSecurityFlag()).isNull();
|
||||
|
@ -94,7 +94,7 @@ public class TaskanaSecurityConfigAccTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void should_SetSecurityFlagToTrue_When_CreatingSecureEngineCfgAndSecurityFlagIsNotSet()
|
||||
void should_SetSecurityFlagToTrue_When_CreatingSecureEngineCfgAndSecurityFlagIsNotSet()
|
||||
throws SQLException {
|
||||
|
||||
assertThat(retrieveSecurityFlag()).isNull();
|
||||
|
|
|
@ -15,7 +15,7 @@ import pro.taskana.workbasket.api.models.WorkbasketAccessItem;
|
|||
|
||||
/** Acceptance test for all "set workbasket access item" scenarios. */
|
||||
@ExtendWith(JaasExtension.class)
|
||||
public class CreateWorkbasketAuthorizationsAccTest extends AbstractAccTest {
|
||||
class CreateWorkbasketAuthorizationsAccTest extends AbstractAccTest {
|
||||
|
||||
@WithAccessId(user = "user_1_1")
|
||||
@WithAccessId(user = "taskadmin")
|
||||
|
|
|
@ -14,12 +14,12 @@ import pro.taskana.workbasket.api.WorkbasketService;
|
|||
|
||||
/** Acceptance test for all "delete workbasket authorizations" scenarios. */
|
||||
@ExtendWith(JaasExtension.class)
|
||||
public class DeleteWorkbasketAuthorizationsAccTest extends AbstractAccTest {
|
||||
class DeleteWorkbasketAuthorizationsAccTest extends AbstractAccTest {
|
||||
|
||||
@WithAccessId(user = "user_1_1")
|
||||
@WithAccessId(user = "taskadmin")
|
||||
@TestTemplate
|
||||
public void should_ThrowException_When_UserRoleIsNotAdminOrBusinessAdmin() {
|
||||
void should_ThrowException_When_UserRoleIsNotAdminOrBusinessAdmin() {
|
||||
|
||||
final WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
||||
|
||||
|
|
|
@ -14,12 +14,12 @@ import pro.taskana.workbasket.api.WorkbasketService;
|
|||
|
||||
/** Acceptance test for all "get workbasket authorizations" scenarios. */
|
||||
@ExtendWith(JaasExtension.class)
|
||||
public class GetWorkbasketAuthorizationsAccTest extends AbstractAccTest {
|
||||
class GetWorkbasketAuthorizationsAccTest extends AbstractAccTest {
|
||||
|
||||
@WithAccessId(user = "user_1_1")
|
||||
@WithAccessId(user = "taskadmin")
|
||||
@TestTemplate
|
||||
public void should_ThrowException_When_UserRoleIsNotAdminOrBusinessAdmin() {
|
||||
void should_ThrowException_When_UserRoleIsNotAdminOrBusinessAdmin() {
|
||||
|
||||
final WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
||||
|
||||
|
|
|
@ -23,17 +23,13 @@ import pro.taskana.workbasket.internal.models.WorkbasketImpl;
|
|||
|
||||
/** Acceptance test for all "update workbasket" scenarios. */
|
||||
@ExtendWith(JaasExtension.class)
|
||||
public class UpdateWorkbasketAccTest extends AbstractAccTest {
|
||||
|
||||
public UpdateWorkbasketAccTest() {
|
||||
super();
|
||||
}
|
||||
class UpdateWorkbasketAccTest extends AbstractAccTest {
|
||||
|
||||
@WithAccessId(
|
||||
user = "teamlead_1",
|
||||
groups = {"group_1", "businessadmin"})
|
||||
@Test
|
||||
public void testUpdateWorkbasket()
|
||||
void testUpdateWorkbasket()
|
||||
throws NotAuthorizedException, WorkbasketNotFoundException, ConcurrencyException {
|
||||
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
||||
Workbasket workbasket = workbasketService.getWorkbasket("GPK_KSC", "DOMAIN_A");
|
||||
|
@ -67,7 +63,7 @@ public class UpdateWorkbasketAccTest extends AbstractAccTest {
|
|||
user = "teamlead_1",
|
||||
groups = {"group_1", "businessadmin"})
|
||||
@Test
|
||||
public void testUpdateWorkbasketWithConcurrentModificationShouldThrowException()
|
||||
void testUpdateWorkbasketWithConcurrentModificationShouldThrowException()
|
||||
throws NotAuthorizedException, WorkbasketNotFoundException, ConcurrencyException {
|
||||
|
||||
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
||||
|
@ -85,7 +81,7 @@ public class UpdateWorkbasketAccTest extends AbstractAccTest {
|
|||
user = "teamlead_1",
|
||||
groups = {"group_1", "businessadmin"})
|
||||
@Test
|
||||
public void testUpdateWorkbasketOfNonExistingWorkbasketShouldThrowException()
|
||||
void testUpdateWorkbasketOfNonExistingWorkbasketShouldThrowException()
|
||||
throws NotAuthorizedException, WorkbasketNotFoundException, ConcurrencyException {
|
||||
|
||||
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
||||
|
@ -103,7 +99,7 @@ public class UpdateWorkbasketAccTest extends AbstractAccTest {
|
|||
@WithAccessId(user = "user_1_1", groups = "group_1")
|
||||
@WithAccessId(user = "taskadmin")
|
||||
@TestTemplate
|
||||
public void should_ThrowException_When_UserRoleIsNotAdminOrBusinessAdmin()
|
||||
void should_ThrowException_When_UserRoleIsNotAdminOrBusinessAdmin()
|
||||
throws NotAuthorizedException, WorkbasketNotFoundException {
|
||||
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
||||
Workbasket workbasket = workbasketService.getWorkbasket("USER_1_1", "DOMAIN_A");
|
||||
|
|
|
@ -40,7 +40,7 @@ class UpdateWorkbasketAuthorizationsAccTest extends AbstractAccTest {
|
|||
@WithAccessId(user = "user_1_1")
|
||||
@WithAccessId(user = "taskadmin")
|
||||
@TestTemplate
|
||||
public void should_ThrowException_When_UserIsNotAdminOrBusinessAdmin() {
|
||||
void should_ThrowException_When_UserIsNotAdminOrBusinessAdmin() {
|
||||
|
||||
final WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.junit.jupiter.api.TestTemplate;
|
|||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
@ExtendWith(JaasExtension.class)
|
||||
public class JaasExtensionTest {
|
||||
class JaasExtensionTest {
|
||||
|
||||
private static final String INSIDE_DYNAMIC_TEST_USER = "insidedynamictest";
|
||||
private static final DynamicTest NOT_NULL_DYNAMIC_TEST =
|
||||
|
|
Loading…
Reference in New Issue