-
Notifications
You must be signed in to change notification settings - Fork 682
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
[#1849] Exceptions from controllers are not detected in FunctionalTests #1246
Merged
asolntsev
merged 10 commits into
playframework:master
from
qudini:1849_controllerException
Jul 31, 2018
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
139e2fa
[#1849] Made an unrelated test a little bit more robust against timin…
29c7e3f
[#1849] Added test cases that show the unexpected behavior
ea60d35
[#1849] Adapted BinaryTest to reflect corrected expectations
f5419be
[#1849] Fixed that exceptions from controllers are being ignored
0dfbbfb
[#1849] Give tests more fine grained control over what exceptions the…
27db29e
Merge branch 'master' into 1849_controllerException
LouisJackman b41ebc3
Resolved merge conflict
Fraserhardy 2637d90
Merge pull request #1 from playframework/master
Fraserhardy 97c3ebc
Merge branch 'master' into 1849_controllerException
Fraserhardy 28b06cd
Fixed issue with Transactional Tests
Fraserhardy 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 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
36 changes: 36 additions & 0 deletions
36
samples-and-tests/just-test-cases/app/controllers/StatusCodes.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,36 @@ | ||
package controllers; | ||
|
||
import play.jobs.Job; | ||
import play.mvc.Controller; | ||
import play.mvc.Http.Response; | ||
|
||
public class StatusCodes extends Controller { | ||
|
||
public static void justOkay() { | ||
renderText("Okay"); | ||
} | ||
|
||
public static void rendersNotFound() { | ||
notFound(); | ||
} | ||
|
||
public static void rendersUnauthorized() { | ||
unauthorized(); | ||
} | ||
|
||
public static void usesContinuation() { | ||
final String text = await(new Job<String>() { | ||
@Override | ||
public String doJobWithResult() throws Exception { | ||
return "Job completed successfully"; | ||
} | ||
}.now()); | ||
Response.current().status = Integer.valueOf(201); | ||
renderText(text); | ||
} | ||
|
||
public static void throwsException() throws Exception { | ||
throw new UnsupportedOperationException("Whoops"); | ||
} | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ public void setUp() { | |
Response deletedResponse = GET(deleteURL); | ||
assertStatus(200, deletedResponse); | ||
} | ||
|
||
@Test | ||
public void testUploadSomething() { | ||
URL imageURL = reverse(); { | ||
|
@@ -235,11 +235,13 @@ public void testGetEmptyBinary() { | |
assertTrue(Binary.emptyInputStreamClosed); | ||
} | ||
|
||
@Test | ||
@Test(expected = Exception.class) | ||
public void testGetErrorBinary() { | ||
Response response = GET("/binary/getErrorBinary"); | ||
// This does not work. See Lighthouse ticket #1637. | ||
// assertStatus(500, response); | ||
assertTrue(Binary.errorInputStreamClosed); | ||
try { | ||
GET("/binary/getErrorBinary"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Fraserhardy It doesn't seem to be a correct test. |
||
} | ||
finally { | ||
assertTrue(Binary.errorInputStreamClosed); | ||
} | ||
} | ||
} |
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.
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 is bug. Change
throw (RuntimeException) originalCause;
toreturn (RuntimeException) originalCause;