@Test public void testFindAlreadyDefinedResource() throws Exception { Resource resource = AbstractDefineResourcesMojo.findOrCreateResource(resources, "src/main/another-folder"); assertThat(resource, not(mockResource)); assertThat(resource, notNullValue()); }
static Resource findOrCreateResource(final List<Resource> resources, final String resourceDirectory) { if (resourceDirectory == null) { throw new IllegalArgumentException("The resource directory argument cannot be null"); } for (Resource resource : resources) { if (resourceDirectory.equals(resource.getDirectory())) { return resource; } } Resource resource = new Resource(); resource.setDirectory(resourceDirectory); return resource; }
AbstractDefineResourcesMojo extends AbstractWOMojo { static Resource findOrCreateResource(final List<Resource> resources, final String resourceDirectory) { if (resourceDirectory == null) { throw new IllegalArgumentException("The resource directory argument cannot be null"); } for (Resource resource : resources) { if (resourceDirectory.equals(resource.getDirectory())) { return resource; } } Resource resource = new Resource(); resource.setDirectory(resourceDirectory); return resource; } }
AbstractDefineResourcesMojo extends AbstractWOMojo { static Resource findOrCreateResource(final List<Resource> resources, final String resourceDirectory) { if (resourceDirectory == null) { throw new IllegalArgumentException("The resource directory argument cannot be null"); } for (Resource resource : resources) { if (resourceDirectory.equals(resource.getDirectory())) { return resource; } } Resource resource = new Resource(); resource.setDirectory(resourceDirectory); return resource; } AbstractDefineResourcesMojo(); }
AbstractDefineResourcesMojo extends AbstractWOMojo { static Resource findOrCreateResource(final List<Resource> resources, final String resourceDirectory) { if (resourceDirectory == null) { throw new IllegalArgumentException("The resource directory argument cannot be null"); } for (Resource resource : resources) { if (resourceDirectory.equals(resource.getDirectory())) { return resource; } } Resource resource = new Resource(); resource.setDirectory(resourceDirectory); return resource; } AbstractDefineResourcesMojo(); void execute(); Boolean flattenResources(); abstract boolean hasContentsFolder(); abstract boolean includesVersionInArtifactName(); void setFlattingResources(final Boolean flattenResources); }
AbstractDefineResourcesMojo extends AbstractWOMojo { static Resource findOrCreateResource(final List<Resource> resources, final String resourceDirectory) { if (resourceDirectory == null) { throw new IllegalArgumentException("The resource directory argument cannot be null"); } for (Resource resource : resources) { if (resourceDirectory.equals(resource.getDirectory())) { return resource; } } Resource resource = new Resource(); resource.setDirectory(resourceDirectory); return resource; } AbstractDefineResourcesMojo(); void execute(); Boolean flattenResources(); abstract boolean hasContentsFolder(); abstract boolean includesVersionInArtifactName(); void setFlattingResources(final Boolean flattenResources);  }