TSK-1240: PR amends
This commit is contained in:
parent
140134eec5
commit
7e6c045ded
|
@ -107,13 +107,7 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tngtech.archunit</groupId>
|
<groupId>com.tngtech.archunit</groupId>
|
||||||
<artifactId>archunit-junit5-api</artifactId>
|
<artifactId>archunit</artifactId>
|
||||||
<version>${version.archunit}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.tngtech.archunit</groupId>
|
|
||||||
<artifactId>archunit-junit5-engine</artifactId>
|
|
||||||
<version>${version.archunit}</version>
|
<version>${version.archunit}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
|
@ -167,7 +167,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tngtech.archunit</groupId>
|
<groupId>com.tngtech.archunit</groupId>
|
||||||
<artifactId>archunit</artifactId>
|
<artifactId>archunit</artifactId>
|
||||||
<version>0.20.1</version>
|
<version>${version.archunit}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
@ -13,19 +13,13 @@ import com.tngtech.archunit.lang.ArchCondition;
|
||||||
import com.tngtech.archunit.lang.ArchRule;
|
import com.tngtech.archunit.lang.ArchRule;
|
||||||
import com.tngtech.archunit.lang.ConditionEvents;
|
import com.tngtech.archunit.lang.ConditionEvents;
|
||||||
import com.tngtech.archunit.lang.SimpleConditionEvent;
|
import com.tngtech.archunit.lang.SimpleConditionEvent;
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import pro.taskana.common.rest.QueryParameter;
|
||||||
|
|
||||||
public class SpringArchitectureTest {
|
public class SpringArchitectureTest {
|
||||||
private static final List<String> TASKANA_SUB_PACKAGES =
|
|
||||||
List.of(
|
|
||||||
"pro.taskana.common.rest",
|
|
||||||
"pro.taskana.classification.rest",
|
|
||||||
"pro.taskana.task.rest",
|
|
||||||
"pro.taskana.workbasket.rest",
|
|
||||||
"pro.taskana.monitor.rest");
|
|
||||||
private static JavaClasses importedClasses;
|
private static JavaClasses importedClasses;
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
|
@ -37,16 +31,14 @@ public class SpringArchitectureTest {
|
||||||
@Test
|
@Test
|
||||||
void should_AnnotateAllFieldsWithJsonProperty_When_ImplementingQueryParameter() {
|
void should_AnnotateAllFieldsWithJsonProperty_When_ImplementingQueryParameter() {
|
||||||
ArchRule myRule =
|
ArchRule myRule =
|
||||||
classes()
|
classes().that().implement(QueryParameter.class).should(shouldOnlyHaveAnnotatedFields());
|
||||||
.that()
|
|
||||||
.implement(pro.taskana.common.rest.QueryParameter.class)
|
|
||||||
.should(shouldOnlyHaveAnnotatedFields());
|
|
||||||
|
|
||||||
myRule.check(importedClasses);
|
myRule.check(importedClasses);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArchCondition<JavaClass> shouldOnlyHaveAnnotatedFields() {
|
private ArchCondition<JavaClass> shouldOnlyHaveAnnotatedFields() {
|
||||||
return new ArchCondition<JavaClass>("have all fields without a @JsonProperty annotation") {
|
return new ArchCondition<JavaClass>(
|
||||||
|
"all fields should have a @JsonProperty or @JsonIgnore annotation") {
|
||||||
@Override
|
@Override
|
||||||
public void check(JavaClass javaClass, ConditionEvents events) {
|
public void check(JavaClass javaClass, ConditionEvents events) {
|
||||||
for (JavaField field : javaClass.getAllFields()) {
|
for (JavaField field : javaClass.getAllFields()) {
|
||||||
|
|
Loading…
Reference in New Issue