CommandCreateModeFromFile implements CommandProcessor { @Override public void process(CommandLine cmd) { String filePath = cmd.getOptionValue("file"); if (StringUtils.isEmpty(filePath)) { throw new IllegalArgumentException("File argument must be specified."); } if (cmd.hasOption("noPseudonym")) { dncPipelineService.getCommandLineArgHolder().setNoPseudonym(true); } dncPipelineService.startCreateModeWithFile(filePath); }  @Override boolean isResponsibleFor(CommandLine cmd); @Override void process(CommandLine cmd); @Override void addOption(Options options); @Autowired
    public DNCPipelineService dncPipelineService; }
@Test(expected = IllegalArgumentException.class) public void shouldThrowExceptionIfFilePathIsNotGiven() { CommandLine cmd = mock(CommandLine.class); when(cmd.getOptionValue("file")).thenReturn(""); commandCreateModeFromFile.process(cmd); }
@Test public void shouldCallPipelineServiceWhenFilePathIsGiven() { CommandLine cmd = mock(CommandLine.class); when(cmd.getOptionValue("file")).thenReturn("path/to/file"); commandCreateModeFromFile.process(cmd); verify(dncPipelineService).startCreateModeWithFile("path/to/file"); }