@Test public void testNoPackageFound() throws IOException { String expectedHtmlResponse = "<html>\n" + " <head>\n" + " <title>Not Found</title>\n" + " </head>\n" + " <body>\n" + " <h1>Not Found</h1>\n" + " </body>\n" + "</html>"; String htmlResponse = htmlResponseBuilder.getHtmlResponse(new ArrayList<>()); assertThat(htmlResponse).isNotBlank().isEqualTo(expectedHtmlResponse); }
public String getHtmlResponse(List<Path> filePaths) throws IOException { String htmlResponse = ""; if (CollectionUtils.isEmpty(filePaths)) { htmlResponse = "<html>\n" + " <head>\n" + " <title>Not Found</title>\n" + " </head>\n" + " <body>\n" + " <h1>Not Found</h1>\n" + " </body>\n" + "</html>"; } else { PypiArtifactCoordinates artifactCoordinates = (PypiArtifactCoordinates) RepositoryFiles.readCoordinates((RepositoryPath) filePaths.get(0)); final String packageName = artifactCoordinates.getId(); htmlResponse = "<html>\n" + " <head>\n" + " <title>Links for " + packageName + "</title>\n" + " </head>\n" + " <body>\n" + " <h1>Links for " + packageName + "</h1>\n" + " " + getPackageLinks(filePaths) + " </body>\n" + "</html>"; } return htmlResponse; }
PypiBrowsePackageHtmlResponseBuilder { public String getHtmlResponse(List<Path> filePaths) throws IOException { String htmlResponse = ""; if (CollectionUtils.isEmpty(filePaths)) { htmlResponse = "<html>\n" + " <head>\n" + " <title>Not Found</title>\n" + " </head>\n" + " <body>\n" + " <h1>Not Found</h1>\n" + " </body>\n" + "</html>"; } else { PypiArtifactCoordinates artifactCoordinates = (PypiArtifactCoordinates) RepositoryFiles.readCoordinates((RepositoryPath) filePaths.get(0)); final String packageName = artifactCoordinates.getId(); htmlResponse = "<html>\n" + " <head>\n" + " <title>Links for " + packageName + "</title>\n" + " </head>\n" + " <body>\n" + " <h1>Links for " + packageName + "</h1>\n" + " " + getPackageLinks(filePaths) + " </body>\n" + "</html>"; } return htmlResponse; } }
PypiBrowsePackageHtmlResponseBuilder { public String getHtmlResponse(List<Path> filePaths) throws IOException { String htmlResponse = ""; if (CollectionUtils.isEmpty(filePaths)) { htmlResponse = "<html>\n" + " <head>\n" + " <title>Not Found</title>\n" + " </head>\n" + " <body>\n" + " <h1>Not Found</h1>\n" + " </body>\n" + "</html>"; } else { PypiArtifactCoordinates artifactCoordinates = (PypiArtifactCoordinates) RepositoryFiles.readCoordinates((RepositoryPath) filePaths.get(0)); final String packageName = artifactCoordinates.getId(); htmlResponse = "<html>\n" + " <head>\n" + " <title>Links for " + packageName + "</title>\n" + " </head>\n" + " <body>\n" + " <h1>Links for " + packageName + "</h1>\n" + " " + getPackageLinks(filePaths) + " </body>\n" + "</html>"; } return htmlResponse; }  }
PypiBrowsePackageHtmlResponseBuilder { public String getHtmlResponse(List<Path> filePaths) throws IOException { String htmlResponse = ""; if (CollectionUtils.isEmpty(filePaths)) { htmlResponse = "<html>\n" + " <head>\n" + " <title>Not Found</title>\n" + " </head>\n" + " <body>\n" + " <h1>Not Found</h1>\n" + " </body>\n" + "</html>"; } else { PypiArtifactCoordinates artifactCoordinates = (PypiArtifactCoordinates) RepositoryFiles.readCoordinates((RepositoryPath) filePaths.get(0)); final String packageName = artifactCoordinates.getId(); htmlResponse = "<html>\n" + " <head>\n" + " <title>Links for " + packageName + "</title>\n" + " </head>\n" + " <body>\n" + " <h1>Links for " + packageName + "</h1>\n" + " " + getPackageLinks(filePaths) + " </body>\n" + "</html>"; } return htmlResponse; }  String getHtmlResponse(List<Path> filePaths); }
PypiBrowsePackageHtmlResponseBuilder { public String getHtmlResponse(List<Path> filePaths) throws IOException { String htmlResponse = ""; if (CollectionUtils.isEmpty(filePaths)) { htmlResponse = "<html>\n" + " <head>\n" + " <title>Not Found</title>\n" + " </head>\n" + " <body>\n" + " <h1>Not Found</h1>\n" + " </body>\n" + "</html>"; } else { PypiArtifactCoordinates artifactCoordinates = (PypiArtifactCoordinates) RepositoryFiles.readCoordinates((RepositoryPath) filePaths.get(0)); final String packageName = artifactCoordinates.getId(); htmlResponse = "<html>\n" + " <head>\n" + " <title>Links for " + packageName + "</title>\n" + " </head>\n" + " <body>\n" + " <h1>Links for " + packageName + "</h1>\n" + " " + getPackageLinks(filePaths) + " </body>\n" + "</html>"; } return htmlResponse; }  String getHtmlResponse(List<Path> filePaths);  }