File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
main/java/org/junit/rules
test/java/org/junit/tests/experimental/rules Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -73,12 +73,12 @@ public Object call() throws Exception {
7373 * Execution continues, but the test will fail at the end if
7474 * {@code callable} threw an exception.
7575 */
76- public Object checkSucceeds (Callable <Object > callable ) {
76+ public < T > T checkSucceeds (Callable <T > callable ) {
7777 try {
7878 return callable .call ();
7979 } catch (Throwable e ) {
8080 addError (e );
8181 return null ;
8282 }
8383 }
84- }
84+ }
Original file line number Diff line number Diff line change @@ -84,11 +84,17 @@ public Object call() throws Exception {
8484 throw new RuntimeException ("first!" );
8585 }
8686 });
87- collector .checkSucceeds (new Callable <Object >() {
88- public Object call () throws Exception {
87+ collector .checkSucceeds (new Callable <Integer >() {
88+ public Integer call () throws Exception {
8989 throw new RuntimeException ("second!" );
9090 }
9191 });
92+ Integer result = collector .checkSucceeds (new Callable <Integer >() {
93+ public Integer call () throws Exception {
94+ return 1 ;
95+ }
96+ });
97+ assertEquals (Integer .valueOf (1 ), result );
9298 }
9399 }
94100
You can’t perform that action at this time.
0 commit comments