You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for providing and supporting this awesome package!
After upgrading from 0.22.0 to 0.23.0 unfortunately we stumbled across an issue.
Observation
When running the classes().that()... ArchUnit throws an IllegalStateException (with below stacktrace) if one of the classes in the packages that are being analyzed calls the JUnit method org.junit.jupiter.api.assertDoesNotThrow.
Unfortunately we can not simply exclude test classes from ArchUnit, as we have ArchUnit tests that verify that other tests have a certain coverage.
Workaround
We're using the AssertJ equivalent assertThatCode {...}.doesNotThrowAnyException() of assertDoesNotThrow instead.
Additional information
We're using Spring Boot (gradle-plugin version: 2.6.3) with kotlin, Amazon Corretto Java 17.
We're using org.junit.jupiter:junit-jupiter:5.8.2
Hypothesis
This might be related to one of the bug fixes in 0.23.0
Minimal test example that leads to Exception
// this class needs to be analyzed by ArchUnit for the exception to occur
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.assertDoesNotThrow
class AssertDoesNotThrowTest {
@Test
fun breaksArchUnit() {
assertDoesNotThrow {
}
}
}
Stacktrace of exception
java.lang.IllegalStateException: Never found a JavaCodeUnit that matches supposed origin CodeUnit{name='get', descriptor=()Ljava/lang/Object;, declaringClassName='{REDACTED}.AssertDoesNotThrowTest$breaksArchUnit$$inlined$assertDoesNotThrow$1'}
at com.tngtech.archunit.core.importer.AccessRecord$Factory.getOrigin(AccessRecord.java:325)
at com.tngtech.archunit.core.importer.AccessRecord$Factory.access$1200(AccessRecord.java:67)
at com.tngtech.archunit.core.importer.AccessRecord$Factory$10.get(AccessRecord.java:314)
at com.tngtech.archunit.core.importer.AccessRecord$Factory$10.get(AccessRecord.java:311)
at com.tngtech.archunit.thirdparty.com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:167)
at com.tngtech.archunit.core.importer.AccessRecord$Factory$RawAccessRecordProcessed.getOrigin(AccessRecord.java:282)
at com.tngtech.archunit.core.importer.ClassGraphCreator.tryProcess(ClassGraphCreator.java:146)
at com.tngtech.archunit.core.importer.ClassGraphCreator.completeAccesses(ClassGraphCreator.java:121)
at com.tngtech.archunit.core.importer.ClassGraphCreator.complete(ClassGraphCreator.java:103)
at com.tngtech.archunit.core.importer.ClassFileProcessor.process(ClassFileProcessor.java:71)
at com.tngtech.archunit.core.importer.ClassFileImporter.importLocations(ClassFileImporter.java:336)
at com.tngtech.archunit.junit.ClassCache$CacheClassFileImporter.importClasses(ClassCache.java:121)
at com.tngtech.archunit.junit.ClassCache$LazyJavaClasses.initialize(ClassCache.java:113)
at com.tngtech.archunit.junit.ClassCache$LazyJavaClasses.get(ClassCache.java:102)
at com.tngtech.archunit.junit.ClassCache.getClassesToAnalyzeFor(ClassCache.java:79)
at com.tngtech.archunit.junit.ArchUnitTestDescriptor.lambda$createChildren$1(ArchUnitTestDescriptor.java:82)
at com.tngtech.archunit.junit.ArchUnitTestDescriptor$ArchUnitRuleDescriptor.execute(ArchUnitTestDescriptor.java:159)
at com.tngtech.archunit.junit.ArchUnitTestDescriptor$ArchUnitRuleDescriptor.execute(ArchUnitTestDescriptor.java:142)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:108)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:96)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:75)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:99)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:79)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:75)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:61)
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.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
at jdk.proxy1/jdk.proxy1.$Proxy2.stop(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker$3.run(TestWorker.java:193)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:133)
at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:71)
at worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
at worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)
The text was updated successfully, but these errors were encountered:
Hi!
Thank you for providing and supporting this awesome package!
After upgrading from 0.22.0 to 0.23.0 unfortunately we stumbled across an issue.
Observation
When running the
classes().that()...
ArchUnit throws anIllegalStateException
(with below stacktrace) if one of the classes in the packages that are being analyzed calls the JUnit methodorg.junit.jupiter.api.assertDoesNotThrow
.Unfortunately we can not simply exclude test classes from ArchUnit, as we have ArchUnit tests that verify that other tests have a certain coverage.
Workaround
We're using the AssertJ equivalent
assertThatCode {...}.doesNotThrowAnyException()
ofassertDoesNotThrow
instead.Additional information
We're using Spring Boot (gradle-plugin version: 2.6.3) with kotlin, Amazon Corretto Java 17.
We're using org.junit.jupiter:junit-jupiter:5.8.2
Hypothesis
This might be related to one of the bug fixes in 0.23.0
Minimal test example that leads to Exception
Stacktrace of exception
The text was updated successfully, but these errors were encountered: