SwaggerWebAppFraction implements Fraction<SwaggerWebAppFraction> { public SwaggerWebAppFraction addWebContent(String content) { if (content == null) { return this; } if (content.equals("")) { return this; } File maybeFile = new File(content); if (!maybeFile.exists()) { try { this.webContent = ArtifactLookup.get().artifact(content); } catch (Exception e) { SwaggerWebAppMessages.MESSAGES.unableToLocateWebContent(content); } } else if (maybeFile.isDirectory()) { try { this.webContent = loadFromDirectory(maybeFile); } catch (IOException e) { SwaggerWebAppMessages.MESSAGES.unableToLocateWebContent(maybeFile.toString()); } } else { this.webContent = ShrinkWrap.createFromZipFile(JARArchive.class, maybeFile); } return this; } SwaggerWebAppFraction(); String getContext(); void setContext(String context); SwaggerWebAppFraction addWebContent(String content); Archive<?> getWebContent();  }
@Test public void testAddWebContentFromJar() { SwaggerWebAppFraction fraction = new SwaggerWebAppFraction(); fraction.addWebContent("./src/test/user-content.jar"); assertArchive(fraction); }
@Test public void testAddWebContentFromDirectory() { SwaggerWebAppFraction fraction = new SwaggerWebAppFraction(); fraction.addWebContent("./src/test/user-content"); Archive<?> archive = assertArchive(fraction); Node node = archive.get("/js/test.js"); assertThat(node).isNotNull(); node = archive.get("/js/lib/some-lib.js"); assertThat(node).isNotNull(); }