### Question:
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; }### Answer:
@Test public void testGetPomWithFinalSlash() { Path path = mock(Path.class); when(path.toURI()).thenReturn("/"); when(this.importProject.getRoot()).thenReturn(path); this.importProjectValidator.getPom(this.pomService, path); verify(this.pomService).load(pathCaptor.capture()); assertEquals("/pom.xml", pathCaptor.getValue().toURI()); }
@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()); }