ScribeMojo extends AbstractMojo { Project project() { var authors = Stream.of(pom.getContributors(), pom.getDevelopers()) .flatMap(Collection::stream) .map(Contributor::getName) .collect(toList()); var api = ""; for (var dependency : pom.getDependencies()) { var group = Project.DEPENDENCIES.get(dependency.getArtifactId()); if (Objects.equals(group, dependency.getGroupId())) { api = dependency.getVersion(); break; } } return new Project(pom.getName(), pom.getVersion(), api, authors, pom.getDescription(), pom.getUrl()); }  @Override void execute();  }
@Test void project() { var contributor = new Contributor(); contributor.setName("bob"); var developer = new Developer(); developer.setName("bobby"); var dependency = new Dependency(); dependency.setGroupId("org.spigotmc"); dependency.setArtifactId("spigot-api"); dependency.setVersion("1.15-R0.1-SNAPSHOT"); when(pom.getName()).thenReturn("name"); when(pom.getVersion()).thenReturn("version"); when(pom.getDescription()).thenReturn("description"); when(pom.getUrl()).thenReturn("url"); when(pom.getContributors()).thenReturn(List.of(contributor)); when(pom.getDevelopers()).thenReturn(List.of(developer)); when(pom.getDependencies()).thenReturn(List.of(dependency)); var project = mojo.project(); assertEquals("name", project.name); assertEquals("version", project.version); assertEquals("description", project.description); assertEquals("url", project.url); assertEquals("1.15-R0.1-SNAPSHOT", project.api); assertEquals(List.of("bob", "bobby"), project.authors); }