### Question:
ConfigOptionSearchAndRunHandler extends AbstractParseResultHandler<List<Object>> { @Override public List<Object> handle(final ParseResult parseResult) throws ExecutionException { final CommandLine commandLine = parseResult.asCommandLineList().get(0); final Optional<File> configFile = findConfigFile(parseResult, commandLine); commandLine.setDefaultValueProvider(createDefaultValueProvider(commandLine, configFile)); commandLine.parseWithHandlers( resultHandler, exceptionHandler, parseResult.originalArgs().toArray(new String[0])); return new ArrayList<>(); } ConfigOptionSearchAndRunHandler(
      final AbstractParseResultHandler<List<Object>> resultHandler,
      final CommandLine.IExceptionHandler2<List<Object>> exceptionHandler,
      final String configFileOptionName,
      final Map<String, String> environment); @Override List<Object> handle(final ParseResult parseResult); @Override ConfigOptionSearchAndRunHandler self();  }### Answer:
@Test public void handle() throws Exception { when(mockConfigOptionGetter.get()).thenReturn(temp.newFile()); final List<Object> result = configParsingHandler.handle(mockParseResult); verify(mockCommandLine).setDefaultValueProvider(any(IDefaultValueProvider.class)); verify(mockCommandLine).parseWithHandlers(eq(resultHandler), eq(exceptionHandler), anyString()); assertThat(result).isEmpty(); }
@Test public void handleShouldRaiseExceptionIfNoFileParam() throws Exception { exceptionRule.expect(Exception.class); final String error_message = "an error occurred during get"; exceptionRule.expectMessage(error_message); when(mockConfigOptionGetter.get()).thenThrow(new Exception(error_message)); configParsingHandler.handle(mockParseResult); }