AddDirectoryConfigAction { public void execute(DirectoryConfigForm form, DirectoryConfigs directoryConfigs) throws Exception { String path = form.getDirectoryPath(); if (StringUtils.isNotBlank(path)) { log.debug("adding selected directory {} to list", form.getDirectoryPath()); directoryConfigs.add(new DirectoryConfig(path)); } else { log.debug("the directory path is blank; ignoring..."); } }  void execute(DirectoryConfigForm form, DirectoryConfigs directoryConfigs);  }
@Test public void testExecute() throws Exception { AddDirectoryConfigAction action = new AddDirectoryConfigAction(); DirectoryConfigForm form = new DirectoryConfigForm(); form.setDirectoryPath("test"); DirectoryConfigs configs = new DirectoryConfigs(); replay(); action.execute(form, configs); Assert.assertEquals(1, configs.size()); }