Skip to content

Import classes from Main and Test scope #55

Description

@CarlosHeinz

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions