### Question:
ToscaLogic { public void install(String appName, String configurationName) { List<Application> apps = getInstalledApps(); for (Application app : apps) { if (app.getDisplayName().equalsIgnoreCase(appName)) { install(app, configurationName); return; } } throw new NoSuchElementException("No app with this name is installed."); }  List<ConfigurationEntry> getConfigurations(); void install(String appName, String configurationName); void install(Application app, String conigurationName); void install(Application app, Map<String, String> parameters); void waitForInstall(); List<Application> getInstalledApps();  }### Answer:
@Test public void testInstall() { this.toskaLogic.install("Test App", "testConfig"); Map<String, String> args = new HashMap<>(); args.put("testKey", "testValue"); Mockito.verify(this.toscaClient).provisionApplication(ArgumentMatchers.eq(this.apps.get(0)), ArgumentMatchers.eq(args)); }
@Test public void testInstallNoSuchApp() { Assertions.assertThrows(NoSuchElementException.class, () -> this.toskaLogic.install("Not an app", "testConfig")); }
@Test public void testInstallConfigWrong() { Assertions.assertThrows(IllegalArgumentException.class, () -> this.toskaLogic.install("Test App", "not a config")); Assertions.assertThrows(IllegalArgumentException.class, () -> this.toskaLogic.install("Test App", "other")); }