55import org .utplsql .api .reporter .CoreReporters ;
66
77import java .nio .file .Paths ;
8+ import java .sql .SQLException ;
89
910import static org .junit .jupiter .api .Assertions .assertEquals ;
1011
1314 */
1415class RunCommandIT extends AbstractFileOutputTest {
1516
17+ private void assertValidReturnCode (int returnCode ) throws SQLException {
18+ // Only expect failure-exit-code to work on several framework versions
19+ if (OptionalFeatures .FAIL_ON_ERROR .isAvailableFor (TestHelper .getFrameworkVersion ()))
20+ assertEquals (2 , returnCode );
21+ else
22+ assertEquals (0 , returnCode );
23+ }
24+
1625 @ Test
1726 void run_Default () throws Exception {
1827
@@ -23,21 +32,18 @@ void run_Default() throws Exception {
2332 "-c" ,
2433 "--failure-exit-code=2" );
2534
26- // Only expect failure-exit-code to work on several framework versions
27- if (OptionalFeatures .FAIL_ON_ERROR .isAvailableFor (TestHelper .getFrameworkVersion ()))
28- assertEquals (2 , result );
29- else
30- assertEquals (0 , result );
35+ assertValidReturnCode (result );
3136 }
3237
3338 @ Test
3439 void run_Debug () throws Exception {
3540
3641 int result = TestHelper .runApp ("run" ,
3742 TestHelper .getConnectionString (),
38- "--debug" );
43+ "--debug" ,
44+ "--failure-exit-code=2" );
3945
40- assertEquals ( 1 , result );
46+ assertValidReturnCode ( result );
4147 }
4248
4349 @ Test
@@ -55,11 +61,7 @@ void run_MultipleReporters() throws Exception {
5561 "-c" ,
5662 "--failure-exit-code=2" );
5763
58- // Only expect failure-exit-code to work on several framework versions
59- if (OptionalFeatures .FAIL_ON_ERROR .isAvailableFor (TestHelper .getFrameworkVersion ()))
60- assertEquals (2 , result );
61- else
62- assertEquals (0 , result );
64+ assertValidReturnCode (result );
6365 }
6466
6567
0 commit comments