-
Notifications
You must be signed in to change notification settings - Fork 789
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract transiency check to Exception utils and other review remarks
- Loading branch information
1 parent
5e06684
commit 118eb8b
Showing
9 changed files
with
63 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
messaging/src/test/java/org/axonframework/common/ExceptionUtilsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package org.axonframework.common; | ||
|
||
import org.axonframework.commandhandling.NoHandlerForCommandException; | ||
import org.axonframework.serialization.SerializationException; | ||
import org.junit.jupiter.api.*; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
/** | ||
* @author Stefan Andjelkovic | ||
*/ | ||
class ExceptionUtilsTest { | ||
@Test | ||
void isExplicitlyNonTransientForTransientExceptions() { | ||
NoHandlerForCommandException transientException = new NoHandlerForCommandException("No handler message"); | ||
assertFalse(ExceptionUtils.isExplicitlyNonTransient(transientException)); | ||
} | ||
|
||
@Test | ||
void isExplicitlyNonTransientForRegularExceptions() { | ||
RuntimeException runtimeException = new RuntimeException("Something went wrong"); | ||
assertFalse(ExceptionUtils.isExplicitlyNonTransient(runtimeException)); | ||
} | ||
|
||
@Test | ||
void isExplicitlyNonTransientForNonTransientExceptions() { | ||
SerializationException nonTransientException = new SerializationException("Serialization error"); | ||
assertTrue(ExceptionUtils.isExplicitlyNonTransient(nonTransientException)); | ||
} | ||
|
||
@Test | ||
void isExplicitlyNonTransientForNestedNonTransientException() { | ||
SerializationException nonTransientException = new SerializationException("Serialization error"); | ||
RuntimeException nestedRuntimeException = new RuntimeException("Something went wrong nested", nonTransientException); | ||
RuntimeException baseRuntimeException = new RuntimeException("Something went wrong", nestedRuntimeException); | ||
|
||
assertTrue(ExceptionUtils.isExplicitlyNonTransient(baseRuntimeException)); | ||
} | ||
} |