TNG / ArchUnit

A Java architecture test library, to specify and assert architecture rules in plain Java
http://archunit.org
Apache License 2.0
3.17k stars 287 forks source link

How To : Is there way to filter classes when using `importJar()` #1269

Closed omuomugin closed 5 months ago

omuomugin commented 5 months ago

I have an builded artifacts which I want to test with ArchUnit.

I know you can target only some of the classes using importPackages or importPaths. Is there relevant filtering option for importJar() too ?

What I want to do is code like below (it's written in Kotlin.)

val allClassesInPackages = ClassFileImporter()
    .importJar(JarFile("path/to/jar/file"))
    .onlyImport("path/to/some/classes/")
omuomugin commented 5 months ago

Maybe creating custom ImportOption will solve?? I'll give it a try.