Module { public String getModuleName() { if (pom != null && pom.getName() != null) { return pom.getName(); } else if (pom != null && pom.getGav() != null && pom.getGav().getArtifactId() != null && !pom.getGav().getArtifactId().trim().isEmpty()) { return pom.getGav().getArtifactId(); } else { return getRootPath().getFileName(); } } Module();  Module(final Path rootPath,
                  final Path pomXMLPath,
                  final POM pom);  Module(final Path rootPath,
                  final Path pomXMLPath,
                  final POM pom,
                  final Collection<String> modules);  Module(Path rootPath,
                  Path pomXMLPath); int getNumberOfAssets(); void setNumberOfAssets(int numberOfAssets); Path getRootPath(); Path getPomXMLPath(); String getModuleName(); String getIdentifier(); String getEncodedIdentifier(); Collection<String> getModules(); POM getPom(); void setPom(POM pom); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void nameIsSet() throws Exception { final POM pom = new POM(new GAV("groupId", "artifactId", "version")); pom.setName("my project"); final Module module = new Module(mock(Path.class), mock(Path.class), pom); assertEquals("my project", module.getModuleName()); }
@Test public void nameNotSetUseArtifactId() throws Exception { final POM pom = new POM(new GAV("groupId", "artifactId", "version")); final Module module = new Module(mock(Path.class), mock(Path.class), pom); assertEquals("artifactId", module.getModuleName()); }
@Test public void nameNotSetGAVNotSet() throws Exception { final POM pom = new POM(); final Path rootPath = mock(Path.class); doReturn("myProject").when(rootPath).getFileName(); final Module module = new Module(rootPath, mock(Path.class), pom); assertEquals("myProject", module.getModuleName()); }