File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed
main/java/com/endava/cats/command
test/java/com/endava/cats/command Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change 5555import java .util .concurrent .ExecutorService ;
5656import java .util .concurrent .Executors ;
5757import java .util .concurrent .Future ;
58+ import java .util .concurrent .TimeUnit ;
5859import java .util .stream .Collectors ;
5960
6061import static org .fusesource .jansi .Ansi .ansi ;
116117 GenerateCommand .class ,
117118 ExplainCommand .class
118119 })
119- public class CatsCommand implements Runnable , CommandLine .IExitCodeGenerator {
120+ public class CatsCommand implements Runnable , CommandLine .IExitCodeGenerator , AutoCloseable {
120121
121122 private final PrettyLogger logger ;
122123 private static final String SEPARATOR = "-" .repeat (ConsoleUtils .getConsoleColumns (22 ));
@@ -494,4 +495,17 @@ private List<FuzzingData> filterFuzzingData(List<FuzzingData> fuzzingDataListWit
494495 public int getExitCode () {
495496 return exitCodeDueToErrors + executionStatisticsListener .getErrors ();
496497 }
498+
499+ @ Override
500+ public void close () throws Exception {
501+ executor .shutdown ();
502+ try {
503+ if (!executor .awaitTermination (1 , TimeUnit .SECONDS )) {
504+ executor .shutdownNow ();
505+ }
506+ } catch (InterruptedException e ) {
507+ executor .shutdownNow ();
508+ Thread .currentThread ().interrupt ();
509+ }
510+ }
497511}
Original file line number Diff line number Diff line change @@ -28,16 +28,20 @@ class LintCommandTest {
2828 TestCaseListener testCaseListener ;
2929 @ Inject
3030 FilterArguments filterArguments ;
31+ picocli .CommandLine .Model .CommandSpec spec ;
3132
3233
3334 @ BeforeEach
3435 void init () {
36+ picocli .CommandLine commandLine = new picocli .CommandLine (lintCommand );
37+ spec = commandLine .getCommandSpec ();
3538 ReflectionTestUtils .setField (lintCommand , "contract" , "contract" );
3639 ReflectionTestUtils .setField (filterArguments , "fuzzersToBeRunComputed" , false );
40+ ReflectionTestUtils .setField (filterArguments , "profile" , "full" );
3741 ReflectionTestUtils .setField (lintCommand , "catsCommand" , catsCommand );
42+ ReflectionTestUtils .setField (catsCommand , "spec" , spec );
3843 ReflectionTestUtils .setField (lintCommand , "skipLinters" , Collections .emptyList ());
3944 ReflectionTestUtils .setField (testCaseListener , "testReportsGenerator" , Mockito .mock (TestReportsGenerator .class ));
40-
4145 }
4246
4347 @ Test
You can’t perform that action at this time.
0 commit comments