Coder Social home page Coder Social logo

contextmapper / context-mapper-archunit-extension Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 0.0 113 KB

Validate your code against the CML model with ArchUnit.

Home Page: https://contextmapper.org/

License: Apache License 2.0

Java 100.00%
architecture-validation archunit contextmapper ddd

context-mapper-archunit-extension's People

Contributors

stefan-ka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

context-mapper-archunit-extension's Issues

If in the JAVA code I use a List of Enum but in the model I only have the reference to the Enum, the plugin didn't complain about it.

Describe the bug
When I define a CommandEvent that has a reference to an attribute in the java code but is not the same type, the plugging didn't complain.

To Reproduce
Create your own CommandEvent in the model:

enum UserRole {
           USER_ROLE_1,
           USER_ROLE_2,
           USER_ROLE_3,
           USER_ROLE_4
}

CommandEvent UserChangeRolesCommand {
           - UserId userId;
           - UserRole userRoles;
           - UserId submittedBy;
}

Then in your JAVA code, you make the error to define a list of enums, not just an enum:

@Command
@DomainRing
public final class UserChangeRolesCommand {

    private final UserId userId;
    private final List<UserRole> userRoles;
    private final UserId submittedBy;
    ...

And when compile, the plugging is not complaining about the difference of types

Expected behaviour
I expect that If I define a list in the JAVA code and is not the same type in the model, the plugging complains

IDE and Plugin (please complete the following information):

IntelliJ IDEA 2022.3 (Ultimate Edition)
Build #IU-223.7571.182, built on November 29, 2022
Runtime version: 17.0.5+1-b653.14 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 13.0.1
GC: G1 Young Generation, G1 Old Generation
Non-Bundled Plugins:
com.intellij.kubernetes (223.7571.188)
com.dubreuia (2.3.0)
de.docksnet.puml.syntaxchecker (0.2.0)
PlantUML integration (5.20)
org.asciidoctor.intellij.asciidoc (0.38.3)
org.mapstruct.intellij (1.4.0)
com.haulmont.jpab (2022.5.1-223)
org.sonarlint.idea (7.2.1.58118)

Kotlin: 223-1.7.20-release-201-IJ7571.182

Make compatible with com.tngtech.archunit:archunit-junit5 1.x.x

Currently this library is not working with archunit 1.x.x, due to a breaking change in archunit:

Used version of archunit: 1.0.1

Result when running org.contextmapper.archunitAbstractTacticArchUnitTest#entitiesShouldBeModeledInCML:
`java.lang.IncompatibleClassChangeError: Found interface com.tngtech.archunit.lang.ConditionEvents, but class was expected

at org.contextmapper.archunit.conditions.ModeledAsEntityInContext.check(ModeledAsEntityInContext.java:40)
at org.contextmapper.archunit.conditions.ModeledAsEntityInContext.check(ModeledAsEntityInContext.java:28)
at com.tngtech.archunit.lang.ArchRule$Factory$SimpleArchRule.evaluate(ArchRule.java:186)
at com.tngtech.archunit.lang.ArchRule$Assertions.check(ArchRule.java:84)
at com.tngtech.archunit.lang.ArchRule$Factory$SimpleArchRule.check(ArchRule.java:165)
at com.tngtech.archunit.lang.syntax.ObjectsShouldInternal.check(ObjectsShouldInternal.java:81)
at org.contextmapper.archunit.AbstractTacticArchUnitTest.entitiesShouldBeModeledInCML(AbstractTacticArchUnitTest.java:86)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:725)
at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.