-
Notifications
You must be signed in to change notification settings - Fork 16
Fixes bug in unit tests that meant exceptions were being "hidden" from callables and uses unchecked instead of checked exceptions #7
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
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b7f16f0
specifies surefire plugin versiont to use and updates test to show ca…
michaelruocco 2b6013a
fixes double nested lambda bug that was causing exceptions to not be …
michaelruocco c340f8c
refactors to remove small amount of duplication from exception tests
michaelruocco 17c71f9
updates to throw unchecked rather than checked exception so users are…
michaelruocco c103c55
splits out specific tests for exception handling and reverts old test…
michaelruocco dd8d274
resolve merge conflicts
michaelruocco 0e95daa
adds wrapper methods to return system out and err as a collection of …
michaelruocco File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
.flattened-pom.xml | ||
target | ||
.idea | ||
*.iml | ||
This file contains hidden or 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
8 changes: 8 additions & 0 deletions
8
src/main/java/com/github/stefanbirkner/systemlambda/SystemLambdaExecutionException.java
This file contains hidden or 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,8 @@ | ||
package com.github.stefanbirkner.systemlambda; | ||
|
||
public class SystemLambdaExecutionException extends RuntimeException { | ||
|
||
public SystemLambdaExecutionException(Throwable cause) { | ||
super(cause); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/test/java/com/github/stefanbirkner/systemlambda/FailingCallableMock.java
This file contains hidden or 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,14 @@ | ||
package com.github.stefanbirkner.systemlambda; | ||
|
||
import java.util.concurrent.Callable; | ||
|
||
class FailingCallableMock implements Callable<String> { | ||
boolean hasBeenEvaluated = false; | ||
Exception exception = new Exception("failing callable mock exception"); | ||
|
||
@Override | ||
public String call() throws Exception { | ||
hasBeenEvaluated = true; | ||
throw exception; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/test/java/com/github/stefanbirkner/systemlambda/FailingStatementMock.java
This file contains hidden or 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,12 @@ | ||
package com.github.stefanbirkner.systemlambda; | ||
|
||
class FailingStatementMock implements Statement { | ||
boolean hasBeenEvaluated = false; | ||
Exception exception = new Exception("failing statement mock exception"); | ||
|
||
@Override | ||
public void execute() throws Exception { | ||
hasBeenEvaluated = true; | ||
throw exception; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/test/java/com/github/stefanbirkner/systemlambda/SystemLambdaExecutionExceptionTest.java
This file contains hidden or 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,17 @@ | ||
package com.github.stefanbirkner.systemlambda; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public class SystemLambdaExecutionExceptionTest { | ||
|
||
@Test | ||
void shouldReturnCause() { | ||
Throwable cause = new Exception("cause"); | ||
|
||
Throwable exception = new SystemLambdaExecutionException(cause); | ||
|
||
assertThat(exception.getCause()).isEqualTo(cause); | ||
} | ||
} |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be part of your personal global gitignore file. From the git docs:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah okay nice, ill take a look at setting this up, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be done that way, though it's probably a nicety to allow it in the repo too.