@Test public void testAddFeatureRepositoriesWithNullRepoList() throws MojoExecutionException { FeaturesService featureService = mock(FeaturesService.class); replay(featureService); RunMojo mojo = new RunMojo(); mojo.addFeatureRepositories(featureService); verify(featureService); }
void addFeatureRepositories(Object featureService) throws MojoExecutionException { if (featureRepositories != null) { try { Class<? extends Object> serviceClass = featureService.getClass(); Method addRepositoryMethod = serviceClass.getMethod("addRepository", URI.class); for (String featureRepo : featureRepositories) { addRepositoryMethod.invoke(featureService, URI.create(featureRepo)); } } catch (Exception e) { throw new MojoExecutionException("Failed to add feature repositories to karaf", e); } } }
RunMojo extends MojoSupport { void addFeatureRepositories(Object featureService) throws MojoExecutionException { if (featureRepositories != null) { try { Class<? extends Object> serviceClass = featureService.getClass(); Method addRepositoryMethod = serviceClass.getMethod("addRepository", URI.class); for (String featureRepo : featureRepositories) { addRepositoryMethod.invoke(featureService, URI.create(featureRepo)); } } catch (Exception e) { throw new MojoExecutionException("Failed to add feature repositories to karaf", e); } } } }
RunMojo extends MojoSupport { void addFeatureRepositories(Object featureService) throws MojoExecutionException { if (featureRepositories != null) { try { Class<? extends Object> serviceClass = featureService.getClass(); Method addRepositoryMethod = serviceClass.getMethod("addRepository", URI.class); for (String featureRepo : featureRepositories) { addRepositoryMethod.invoke(featureService, URI.create(featureRepo)); } } catch (Exception e) { throw new MojoExecutionException("Failed to add feature repositories to karaf", e); } } }  }
RunMojo extends MojoSupport { void addFeatureRepositories(Object featureService) throws MojoExecutionException { if (featureRepositories != null) { try { Class<? extends Object> serviceClass = featureService.getClass(); Method addRepositoryMethod = serviceClass.getMethod("addRepository", URI.class); for (String featureRepo : featureRepositories) { addRepositoryMethod.invoke(featureService, URI.create(featureRepo)); } } catch (Exception e) { throw new MojoExecutionException("Failed to add feature repositories to karaf", e); } } }  void execute(); static void extract(File sourceFile, File targetFolder); }
RunMojo extends MojoSupport { void addFeatureRepositories(Object featureService) throws MojoExecutionException { if (featureRepositories != null) { try { Class<? extends Object> serviceClass = featureService.getClass(); Method addRepositoryMethod = serviceClass.getMethod("addRepository", URI.class); for (String featureRepo : featureRepositories) { addRepositoryMethod.invoke(featureService, URI.create(featureRepo)); } } catch (Exception e) { throw new MojoExecutionException("Failed to add feature repositories to karaf", e); } } }  void execute(); static void extract(File sourceFile, File targetFolder);  }