TSK-1922: disabled cyclic dependency architecture tests (#2074)

* TSK-1922: fixed naming of some tests (to satisfy an architecture test)

* TSK-1922: disabled cyclic dependency architecture test

Since they disturb development too much
This commit is contained in:
Mustapha Zorgati 2023-01-30 16:23:22 +01:00 committed by GitHub
parent a5c24e29cc
commit b6834203e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 40 additions and 218945 deletions

View File

@ -1,24 +0,0 @@
Method <acceptance.PojoTest.equalsContract()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (PojoTest.java:39)
Method <acceptance.PojoTest.testsThatPojoClassesAreFound()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (PojoTest.java:34)
Method <acceptance.PojoTest.validateGetAndSet()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (PojoTest.java:70)
Method <acceptance.PojoTest.validateGetters()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (PojoTest.java:49)
Method <acceptance.PojoTest.validateNoPublicFields()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (PojoTest.java:90)
Method <acceptance.PojoTest.validateNoStaticExceptFinalFields()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (PojoTest.java:80)
Method <acceptance.PojoTest.validateSetters()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (PojoTest.java:59)
Method <acceptance.classification.create.CreateClassificationAccTest.should_ThrowException_TryingToCreateClassificationWithExplicitId()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (CreateClassificationAccTest.java:250)
Method <acceptance.classification.create.CreateClassificationAccTest.should_ThrowException_TryingToCreateClassificationWithInvalidCategory()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (CreateClassificationAccTest.java:211)
Method <acceptance.classification.create.CreateClassificationAccTest.should_ThrowException_TryingToCreateClassificationWithInvalidParentId()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (CreateClassificationAccTest.java:238)
Method <acceptance.classification.create.CreateClassificationAccTest.should_ThrowException_TryingToCreateClassificationWithInvalidParentKey()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (CreateClassificationAccTest.java:226)
Method <acceptance.classification.create.CreateClassificationAccTest.should_ThrowException_TryingToCreateClassificationWithInvalidType()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (CreateClassificationAccTest.java:197)
Method <acceptance.jobs.helper.TaskUpdatePriorityWorkerAccTest$WithSpi.should_executeBatch()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (TaskUpdatePriorityWorkerAccTest.java:145)
Method <acceptance.jobs.helper.TaskUpdatePriorityWorkerAccTest.should_loadAnyRelevantTaskIds()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (TaskUpdatePriorityWorkerAccTest.java:87)
Method <acceptance.jobs.helper.TaskUpdatePriorityWorkerAccTest.should_loadExistingTaskIds()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (TaskUpdatePriorityWorkerAccTest.java:97)
Method <acceptance.jobs.helper.TaskUpdatePriorityWorkerAccTest.should_notLoadAnyIrrelevantTaskIds()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (TaskUpdatePriorityWorkerAccTest.java:108)
Method <acceptance.jobs.helper.TaskUpdatePriorityWorkerAccTest.should_noticeDifferentPriority_When_PriorityHasChanged()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (TaskUpdatePriorityWorkerAccTest.java:117)
Method <acceptance.task.create.CreateTaskWithSorAccTest.should_copyObjectReferences_When_DuplicatingTask()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (CreateTaskWithSorAccTest.java:136)
Method <acceptance.task.create.CreateTaskWithSorAccTest.should_createObjectReferences_When_CreatingTask()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (CreateTaskWithSorAccTest.java:68)
Method <acceptance.task.update.UpdateManualPriorityAccTest.should_setPriorityAccordingToClassification_When_NegativeManualPriority()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (UpdateManualPriorityAccTest.java:77)
Method <acceptance.task.update.UpdateManualPriorityAccTest.should_setPriorityToManualPriority_When_PositiveManualPriority()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (UpdateManualPriorityAccTest.java:65)
Method <acceptance.task.update.UpdateManualPriorityWithSpiAccTest$UpdateManualPriorityTest.should_setPriorityToManualAndNotUpdateAccordingToSpi_When_ManualPriorityPositive()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (UpdateManualPriorityWithSpiAccTest.java:87)
Method <acceptance.task.update.UpdateManualPriorityWithSpiAccTest$UpdateManualPriorityTest.should_setPriorityUsingSpi_When_ManualPriorityNegative()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (UpdateManualPriorityWithSpiAccTest.java:101)
Method <acceptance.taskpreprocessing.CreateTaskPreprocessingAccTest.should_processTaskBeforeCreation_When_CreateTaskPreprocessorEnabled()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (CreateTaskPreprocessingAccTest.java:61)

View File

@ -1,24 +0,0 @@
Method <acceptance.PojoTest.equalsContract()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (PojoTest.java:39)
Method <acceptance.PojoTest.testsThatPojoClassesAreFound()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (PojoTest.java:34)
Method <acceptance.PojoTest.validateGetAndSet()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (PojoTest.java:70)
Method <acceptance.PojoTest.validateGetters()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (PojoTest.java:49)
Method <acceptance.PojoTest.validateNoPublicFields()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (PojoTest.java:90)
Method <acceptance.PojoTest.validateNoStaticExceptFinalFields()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (PojoTest.java:80)
Method <acceptance.PojoTest.validateSetters()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (PojoTest.java:59)
Method <acceptance.classification.create.CreateClassificationAccTest.should_ThrowException_TryingToCreateClassificationWithExplicitId()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (CreateClassificationAccTest.java:250)
Method <acceptance.classification.create.CreateClassificationAccTest.should_ThrowException_TryingToCreateClassificationWithInvalidCategory()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (CreateClassificationAccTest.java:211)
Method <acceptance.classification.create.CreateClassificationAccTest.should_ThrowException_TryingToCreateClassificationWithInvalidParentId()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (CreateClassificationAccTest.java:238)
Method <acceptance.classification.create.CreateClassificationAccTest.should_ThrowException_TryingToCreateClassificationWithInvalidParentKey()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (CreateClassificationAccTest.java:226)
Method <acceptance.classification.create.CreateClassificationAccTest.should_ThrowException_TryingToCreateClassificationWithInvalidType()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (CreateClassificationAccTest.java:197)
Method <acceptance.jobs.helper.TaskUpdatePriorityWorkerAccTest$WithSpi.should_executeBatch()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (TaskUpdatePriorityWorkerAccTest.java:145)
Method <acceptance.jobs.helper.TaskUpdatePriorityWorkerAccTest.should_loadAnyRelevantTaskIds()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (TaskUpdatePriorityWorkerAccTest.java:87)
Method <acceptance.jobs.helper.TaskUpdatePriorityWorkerAccTest.should_loadExistingTaskIds()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (TaskUpdatePriorityWorkerAccTest.java:97)
Method <acceptance.jobs.helper.TaskUpdatePriorityWorkerAccTest.should_notLoadAnyIrrelevantTaskIds()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (TaskUpdatePriorityWorkerAccTest.java:108)
Method <acceptance.jobs.helper.TaskUpdatePriorityWorkerAccTest.should_noticeDifferentPriority_When_PriorityHasChanged()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (TaskUpdatePriorityWorkerAccTest.java:117)
Method <acceptance.task.create.CreateTaskWithSorAccTest.should_copyObjectReferences_When_DuplicatingTask()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (CreateTaskWithSorAccTest.java:136)
Method <acceptance.task.create.CreateTaskWithSorAccTest.should_createObjectReferences_When_CreatingTask()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (CreateTaskWithSorAccTest.java:68)
Method <acceptance.task.update.UpdateManualPriorityAccTest.should_setPriorityAccordingToClassification_When_NegativeManualPriority()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (UpdateManualPriorityAccTest.java:77)
Method <acceptance.task.update.UpdateManualPriorityAccTest.should_setPriorityToManualPriority_When_PositiveManualPriority()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (UpdateManualPriorityAccTest.java:65)
Method <acceptance.task.update.UpdateManualPriorityWithSpiAccTest$UpdateManualPriorityTest.should_setPriorityToManualAndNotUpdateAccordingToSpi_When_ManualPriorityPositive()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (UpdateManualPriorityWithSpiAccTest.java:87)
Method <acceptance.task.update.UpdateManualPriorityWithSpiAccTest$UpdateManualPriorityTest.should_setPriorityUsingSpi_When_ManualPriorityNegative()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (UpdateManualPriorityWithSpiAccTest.java:101)
Method <acceptance.taskpreprocessing.CreateTaskPreprocessingAccTest.should_processTaskBeforeCreation_When_CreateTaskPreprocessorEnabled()> does not have name matching '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$' in (CreateTaskPreprocessingAccTest.java:61)

View File

@ -1,6 +0,0 @@
#
#Sat Jan 28 10:53:15 CET 2023
slices\ matching\ 'pro.taskana.(**)'\ should\ be\ free\ of\ cycles=9e212b8e-ebae-4b84-83eb-0b18b9f8a8f3
methods\ that\ are\ annotated\ with\ @Test\ or\ annotated\ with\ @TestFactory\ or\ annotated\ with\ @TestTemplate\ and\ are\ not\ declared\ in\ acceptance.ArchitectureTest\ should\ be\ package\ private\ and\ should\ have\ name\ matching\ '^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$'=74deb6a1-c507-47a1-b135-9308e42f4e71
slices\ assigned\ from\ every\ single\ class\ should\ be\ free\ of\ cycles=978ec381-cf0f-43f8-81ae-72f353d6ada3
no\ classes\ should\ use\ field\ injection,\ because\ field\ injection\ is\ considered\ harmful;\ use\ constructor\ injection\ or\ setter\ injection\ instead;\ see\ https\://stackoverflow.com/q/39890849\ for\ detailed\ explanations=382817ff-573d-4d20-9597-c425d2698970

View File

@ -101,21 +101,20 @@ class ArchitectureTest {
@Test
void testMethodNamesShouldMatchAccordingToOurGuidelines() {
// Frozen, so it can be improved over time:
// https://www.archunit.org/userguide/html/000_Index.html#_freezing_arch_rules
freeze(
methods()
.that(
are(
annotatedWith(Test.class)
.or(annotatedWith(TestFactory.class))
.or(annotatedWith(TestTemplate.class))))
.and()
.areNotDeclaredIn(ArchitectureTest.class)
.should()
.bePackagePrivate()
.andShould()
.haveNameMatching("^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$"))
methods()
.that(
are(
annotatedWith(Test.class)
.or(annotatedWith(TestFactory.class))
.or(annotatedWith(TestTemplate.class))))
.and()
.areNotDeclaredIn(ArchitectureTest.class)
.and()
.areNotDeclaredIn(PojoTest.class) // we have to find a proper naming for those tests
.should()
.bePackagePrivate()
.andShould()
.haveNameMatching("^should_[A-Z][^_]+(_(For|When)_[A-Z][^_]+)?$")
.check(importedClasses);
}
@ -182,16 +181,13 @@ class ArchitectureTest {
@Test
void noClassesShouldUseFieldInjection() {
// Frozen, so it can be improved over time:
// https://www.archunit.org/userguide/html/000_Index.html#_freezing_arch_rules
freeze(
noFields()
.should(BE_ANNOTATED_WITH_AN_INJECTION_ANNOTATION)
.as("no classes should use field injection")
.because(
"field injection is considered harmful; use constructor injection or setter"
+ " injection instead; see https://stackoverflow.com/q/39890849 for"
+ " detailed explanations"))
noFields()
.should(BE_ANNOTATED_WITH_AN_INJECTION_ANNOTATION)
.as("no classes should use field injection")
.because(
"field injection is considered harmful; use constructor injection or setter"
+ " injection instead; see https://stackoverflow.com/q/39890849 for"
+ " detailed explanations")
.check(importedClasses);
}
@ -224,6 +220,7 @@ class ArchitectureTest {
}
@Test
@Disabled("this has way too many false positives during regular development without refactoring")
void packagesShouldBeFreeOfCyclicDependencies() {
// Frozen, so it can be improved over time:
// https://www.archunit.org/userguide/html/000_Index.html#_freezing_arch_rules
@ -231,6 +228,7 @@ class ArchitectureTest {
}
@Test
@Disabled("this has way too many false positives during regular development without refactoring")
void classesShouldBeFreeOfCyclicDependencies() {
SliceAssignment everySingleClass =
new SliceAssignment() {

View File

@ -193,7 +193,7 @@ class CreateClassificationAccTest {
@WithAccessId(user = "businessadmin")
@Test
void should_ThrowException_TryingToCreateClassificationWithInvalidType() {
void should_ThrowException_When_TryingToCreateClassificationWithInvalidType() {
Classification classification =
classificationService.newClassification("KeyErrCreation", "DOMAIN_A", "UNKNOWN_TYPE");
@ -207,7 +207,7 @@ class CreateClassificationAccTest {
@WithAccessId(user = "businessadmin")
@Test
void should_ThrowException_TryingToCreateClassificationWithInvalidCategory() {
void should_ThrowException_When_TryingToCreateClassificationWithInvalidCategory() {
Classification classification =
classificationService.newClassification("KeyErrCreation", "DOMAIN_A", "TASK");
classification.setCategory("UNKNOWN_CATEGORY");
@ -222,7 +222,7 @@ class CreateClassificationAccTest {
@WithAccessId(user = "businessadmin")
@Test
void should_ThrowException_TryingToCreateClassificationWithInvalidParentKey() {
void should_ThrowException_When_TryingToCreateClassificationWithInvalidParentKey() {
Classification classification =
classificationService.newClassification("KeyErrCreation", MASTER_DOMAIN, "TASK");
classification.setParentKey("UNKNOWN_KEY");
@ -234,7 +234,7 @@ class CreateClassificationAccTest {
@WithAccessId(user = "businessadmin")
@Test
void should_ThrowException_TryingToCreateClassificationWithInvalidParentId() {
void should_ThrowException_When_TryingToCreateClassificationWithInvalidParentId() {
Classification classification =
classificationService.newClassification("KeyErr", MASTER_DOMAIN, "TASK");
classification.setParentId("UNKNOWN_ID");
@ -246,7 +246,7 @@ class CreateClassificationAccTest {
@WithAccessId(user = "businessadmin")
@Test
void should_ThrowException_TryingToCreateClassificationWithExplicitId() {
void should_ThrowException_When_TryingToCreateClassificationWithExplicitId() {
ClassificationImpl classification =
(ClassificationImpl)
classificationService.newClassification("KeyErrCreation", MASTER_DOMAIN, "TASK");

View File

@ -82,7 +82,7 @@ class TaskUpdatePriorityWorkerAccTest {
@Test
@WithAccessId(user = "admin")
void should_loadAnyRelevantTaskIds() {
void should_LoadAnyRelevantTaskIds() {
// when
final List<String> allRelevantTaskIds = worker.getAllRelevantTaskIds();
@ -92,7 +92,7 @@ class TaskUpdatePriorityWorkerAccTest {
@Test
@WithAccessId(user = "admin")
void should_loadExistingTaskIds() {
void should_LoadExistingTaskIds() {
// when
final List<TaskSummary> taskSummariesByIds =
worker.getTaskSummariesByIds(List.of(task1.getId(), task2.getId()));
@ -103,7 +103,7 @@ class TaskUpdatePriorityWorkerAccTest {
@Test
@WithAccessId(user = "admin")
void should_notLoadAnyIrrelevantTaskIds() {
void should_NotLoadAnyIrrelevantTaskIds() {
// when
final List<String> allRelevantTaskIds = worker.getAllRelevantTaskIds();
@ -112,7 +112,7 @@ class TaskUpdatePriorityWorkerAccTest {
}
@Test
void should_noticeDifferentPriority_When_PriorityHasChanged() {
void should_NoticeDifferentPriority_When_PriorityHasChanged() {
// given
TaskImpl task = (TaskImpl) taskService.newTask();
task.setPriority(232);
@ -141,7 +141,7 @@ class TaskUpdatePriorityWorkerAccTest {
@Test
@WithAccessId(user = "admin")
void should_executeBatch() throws Exception {
void should_ExecuteBatch() throws Exception {
Task oldTask =
TaskBuilder.newTask()
.classificationSummary(classificationSummary)

View File

@ -64,7 +64,7 @@ class CreateTaskWithSorAccTest {
@WithAccessId(user = "user-1-1")
@Test
void should_createObjectReferences_When_CreatingTask() throws Exception {
void should_CreateObjectReferences_When_CreatingTask() throws Exception {
Task task = taskService.newTask(defaultWorkbasketSummary.getId());
task.setClassificationKey(defaultClassificationSummary.getKey());
task.setPrimaryObjRef(defaultObjectReference);
@ -132,7 +132,7 @@ class CreateTaskWithSorAccTest {
@WithAccessId(user = "user-1-1")
@Test
void should_copyObjectReferences_When_DuplicatingTask() throws Exception {
void should_CopyObjectReferences_When_DuplicatingTask() throws Exception {
ObjectReference sor1 =
ObjectReferenceBuilder.newObjectReference()
.company("FirstCompany")

View File

@ -61,7 +61,7 @@ class UpdateManualPriorityAccTest {
@WithAccessId(user = "user-1-1")
@Test
void should_setPriorityToManualPriority_When_PositiveManualPriority() throws Exception {
void should_SetPriorityToManualPriority_When_PositiveManualPriority() throws Exception {
Task task = taskService.newTask(defaultWorkbasketSummary.getId());
task.setClassificationKey(defaultClassificationSummary.getKey());
task.setPrimaryObjRef(defaultObjectReference);
@ -73,7 +73,7 @@ class UpdateManualPriorityAccTest {
@WithAccessId(user = "user-1-1")
@Test
void should_setPriorityAccordingToClassification_When_NegativeManualPriority() throws Exception {
void should_SetPriorityAccordingToClassification_When_NegativeManualPriority() throws Exception {
Task task = taskService.newTask(defaultWorkbasketSummary.getId());
task.setClassificationKey(defaultClassificationSummary.getKey());
task.setPrimaryObjRef(defaultObjectReference);

View File

@ -82,7 +82,7 @@ class UpdateManualPriorityWithSpiAccTest {
@WithAccessId(user = "user-1-1")
@Test
void should_setPriorityToManualAndNotUpdateAccordingToSpi_When_ManualPriorityPositive()
void should_SetPriorityToManualAndNotUpdateAccordingToSpi_When_ManualPriorityPositive()
throws Exception {
Task task = taskService.newTask(defaultWorkbasketSummary.getId());
task.setClassificationKey(defaultClassificationSummary.getKey());
@ -97,7 +97,7 @@ class UpdateManualPriorityWithSpiAccTest {
@WithAccessId(user = "user-1-1")
@Test
void should_setPriorityUsingSpi_When_ManualPriorityNegative() throws Exception {
void should_SetPriorityUsingSpi_When_ManualPriorityNegative() throws Exception {
Task task = taskService.newTask(defaultWorkbasketSummary.getId());
task.setClassificationKey(defaultClassificationSummary.getKey());
task.setPrimaryObjRef(defaultObjectReference);

View File

@ -57,7 +57,7 @@ class CreateTaskPreprocessingAccTest {
@WithAccessId(user = "user-1-1")
@Test
void should_processTaskBeforeCreation_When_CreateTaskPreprocessorEnabled() throws Exception {
void should_ProcessTaskBeforeCreation_When_CreateTaskPreprocessorEnabled() throws Exception {
Task newTaskToCreate = taskService.newTask(workbasketSummary.getId());
newTaskToCreate.setClassificationKey(classificationSummary.getKey());
newTaskToCreate.setPrimaryObjRef(DefaultTestEntities.defaultTestObjectReference().build());