Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import classes from Main and Test scope #55

Open
1 of 3 tasks
CarlosHeinz opened this issue Aug 4, 2023 · 0 comments
Open
1 of 3 tasks

Import classes from Main and Test scope #55

CarlosHeinz opened this issue Aug 4, 2023 · 0 comments

Comments

@CarlosHeinz
Copy link

Summary

Some test scenarios rely on Main and Test classes as well. Is there a way to configure the scope for both? I guess no, because documentation says
<!-- scope can be "main" or "test" -->

Type of Issue

It is a :

  • bug
  • request
  • question regarding the documentation

Motivation

For example have a look on this rule from GeneralCodingRules
https://github.com/TNG/ArchUnit/blob/43fe9e28f01ba0c781f56fed75977e62251f08e5/archunit/src/main/java/com/tngtech/archunit/library/GeneralCodingRules.java#L434C33-L434C33

It requires Main and Test classes loaded together to compare them and tell if there is a violation.

I can't get this Rule running as intended with this Plugin. However, if i run the Rule as JUnit Test without the Plugin and import Main and Test classes, it works as expected:

@Test
public void testClassesShouldResideInTheSamePackageAsImplementation() {
    JavaClasses myClasses = new ClassFileImporter().importPaths("target/classes", "target/test-classes");
    com.tngtech.archunit.library.GeneralCodingRules.testClassesShouldResideInTheSamePackageAsImplementation().check(myClasses);
}

Current Behavior

Expected Behavior

Steps to Reproduce (for bugs)

Your Environment

  • Version used:
  • OS and version:
  • Version of libs used:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant