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

Improve the handling of exception propagation #656

Merged
merged 5 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@ public class IdentifiedTestException extends RuntimeException {
private final Map<String, Throwable> collectedExceptions;

public IdentifiedTestException(Map<String, Throwable> exceptions) {
super(exceptions.values().stream().findFirst().orElse(null));
this.collectedExceptions = exceptions;
}

public Map<String, Throwable> getCollectedExceptions() {
return collectedExceptions;
}

@Override
public String toString() {
return "IdentifiedTestException [collectedExceptions=" + collectedExceptions + "]";
}
}
6 changes: 6 additions & 0 deletions test/spi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
The tests in this module use a custom maven compiler configuration to simulate a class that exists on the server side but not on the client side to validate the behavior seen in issue
https://github.com/arquillian/arquillian-core/issues/641.

To be able to run these tests from within Intellij, one has to configure the
"Settings | Build, Execution, Deployment | Build Tools | Maven | Runner" to have the "Delegate IDE build/run actions to Maven" box checked.

45 changes: 44 additions & 1 deletion test/spi/pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<!-- Parent -->
<parent>
Expand Down Expand Up @@ -53,5 +55,46 @@
</dependency>

</dependencies>

<build>
<plugins>
<!-- Configure the compiler plugin to not compile the SomeNonClientSideException class into
the test-classes directory so that the standard test runtime will not see it.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<!-- Override the default-testCompile execution to exclude SomeNonClientSideException.java -->
<id>default-testCompile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
<configuration>
<testExcludes>
<testExclude>org/jboss/arquillian/test/spi/serveronly/**</testExclude>
</testExcludes>
</configuration>
</execution>
<execution>
<!-- A custom test-compile execution to output the SomeNonClientSideException.class to target/serveronly-classes -->
<id>serveronly-compile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
<configuration>
<testIncludes>
<testInclude>org/jboss/arquillian/test/spi/serveronly/**</testInclude>
</testIncludes>
<outputDirectory>${project.build.directory}/serveronly-classes</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
*/
package org.jboss.arquillian.test.spi;

import java.io.PrintStream;

/**
* Exception class used when a proxied exception cannot be created. This
* exception type is is thrown instead and contains information about the
* exception type is thrown instead and contains information about the
* proxied class and a hint about why it could not be thrown.
*
* @author <a href="mailto:[email protected]">Andy Gibson</a>
Expand Down Expand Up @@ -59,4 +61,9 @@ public ArquillianProxyException(Throwable cause) {
public ArquillianProxyException(String message, String exceptionClassName, String reason, Throwable cause) {
this(String.format("%s : %s [Proxied because : %s]", exceptionClassName, message, reason), cause);
}

@Override
public void printStackTrace(PrintStream s) {
super.printStackTrace(s);
}
}
Loading
Loading