@Test public void testGetPomWithoutFinalSlash() { Path path = mock(Path.class); when(path.toURI()).thenReturn("/testPath"); when(this.importProject.getRoot()).thenReturn(path); this.importProjectValidator.getPom(this.pomService, path); verify(this.pomService).load(pathCaptor.capture()); assertEquals("/testPath/pom.xml", pathCaptor.getValue().toURI()); }
protected POM getPom(POMService pomService, Path rootPath) { String rootPathUri = rootPath.toURI(); String pomUri = POM_XML; if (!rootPathUri.endsWith("/")) { pomUri = "/" + pomUri; } Path pomPath = PathFactory.newPath(POM_XML, rootPathUri + pomUri); return pomService.load(pomPath); }
ImportProjectValidator { protected POM getPom(POMService pomService, Path rootPath) { String rootPathUri = rootPath.toURI(); String pomUri = POM_XML; if (!rootPathUri.endsWith("/")) { pomUri = "/" + pomUri; } Path pomPath = PathFactory.newPath(POM_XML, rootPathUri + pomUri); return pomService.load(pomPath); } }
ImportProjectValidator { protected POM getPom(POMService pomService, Path rootPath) { String rootPathUri = rootPath.toURI(); String pomUri = POM_XML; if (!rootPathUri.endsWith("/")) { pomUri = "/" + pomUri; } Path pomPath = PathFactory.newPath(POM_XML, rootPathUri + pomUri); return pomService.load(pomPath); }  }
ImportProjectValidator { protected POM getPom(POMService pomService, Path rootPath) { String rootPathUri = rootPath.toURI(); String pomUri = POM_XML; if (!rootPathUri.endsWith("/")) { pomUri = "/" + pomUri; } Path pomPath = PathFactory.newPath(POM_XML, rootPathUri + pomUri); return pomService.load(pomPath); }  Optional<ExampleProjectError> validate(OrganizationalUnit organizationalUnit, ImportProject importProject); }
ImportProjectValidator { protected POM getPom(POMService pomService, Path rootPath) { String rootPathUri = rootPath.toURI(); String pomUri = POM_XML; if (!rootPathUri.endsWith("/")) { pomUri = "/" + pomUri; } Path pomPath = PathFactory.newPath(POM_XML, rootPathUri + pomUri); return pomService.load(pomPath); }  Optional<ExampleProjectError> validate(OrganizationalUnit organizationalUnit, ImportProject importProject); static final String POM_XML; }