ResourceConfig implements Serializable { @Override public String toString() { return "ResourceConfig{" + "url=" + url + ", id='" + id + '\'' + ", resourceType=" + resourceType + '}'; } ResourceConfig(@Nonnull URL url, @Nonnull String id, @Nonnull ResourceType resourceType);   ResourceConfig(@Nonnull Class<?> clazz); @Nonnull URL getUrl(); @Nonnull String getId(); @Nonnull ResourceType getResourceType(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void when_addNonexistentJarWithFile_then_throwsException() { String path = Paths.get("/i/do/not/exist").toString(); File file = new File(path); expectedException.expect(JetException.class); expectedException.expectMessage("Not an existing, readable file: " + path); config.addJar(file); }
@Test public void when_addDuplicateJarWithPath_then_throwsException() throws Exception { String resourceId = "jarfile"; String path1 = createFile("path/to/" + resourceId).toString(); String path2 = createFile("path/to/another/" + resourceId).toString(); config.addJar(path1); expectedException.expect(IllegalArgumentException.class); config.addJar(path2); }
@Test public void when_addNonexistentJarWithPath_then_throwsException() { String path = Paths.get("/i/do/not/exist").toString(); expectedException.expect(JetException.class); expectedException.expectMessage("Not an existing, readable file: " + path); config.addJar(path); }
@Test public void when_addDuplicateZipOfJarWithPath_then_throwsException() throws Exception { String resourceId = "zipFile"; String path1 = createFile("path/to/" + resourceId).toString(); String path2 = createFile("path/to/another/" + resourceId).toString(); config.addJarsInZip(path1); expectedException.expect(IllegalArgumentException.class); config.addJarsInZip(path2); }
@Test public void when_addNonexistentZipOfJarsWithPath_then_throwsException() { String path = Paths.get("/i/do/not/exist").toString(); expectedException.expect(JetException.class); expectedException.expectMessage("Not an existing, readable file: " + path); config.addJarsInZip(path); }
@Test public void when_addNonexistentZipOfJarsWithFile_then_throwsException() { String path = Paths.get("/i/do/not/exist").toString(); File file = new File(path); expectedException.expect(JetException.class); expectedException.expectMessage("Not an existing, readable file: " + path); config.addJarsInZip(file); }
@Test public void when_addDuplicateResourceWithPath_then_throwsException() throws Exception { String resourceId = "my.txt"; String path1 = createFile("path/to/" + resourceId).toString(); String path2 = createFile("path/to/another/" + resourceId).toString(); config.addClasspathResource(path1); expectedException.expect(IllegalArgumentException.class); config.addClasspathResource(path2); }
@Test public void when_addNonexistentResourceWithPath_then_throwsException() { String path = Paths.get("/i/do/not/exist").toString(); expectedException.expect(JetException.class); expectedException.expectMessage("Not an existing, readable file: " + path); config.addClasspathResource(path); }
@Test public void when_addNonexistentResourceWithPathAndId_then_throwsException() { String id = "exist"; String path = Paths.get("/i/do/not/" + id).toString(); expectedException.expect(JetException.class); expectedException.expectMessage("Not an existing, readable file: " + path); config.addClasspathResource(path, id); }
@Test public void when_addNonexistentResourceWithFile_then_throwsException() { String path = Paths.get("/i/do/not/exist").toString(); File file = new File(path); expectedException.expect(JetException.class); expectedException.expectMessage("Not an existing, readable file: " + path); config.addClasspathResource(file); }
@Test public void when_addNonexistentResourceWithFileAndId_then_throwsException() { String id = "exist"; String path = Paths.get("/i/do/not/" + id).toString(); File file = new File(path); expectedException.expect(JetException.class); expectedException.expectMessage("Not an existing, readable file: " + path); config.addClasspathResource(file, id); }
@Test public void when_attachDuplicateFileWithPath_then_throwsException() throws Exception { String resourceId = "resource"; String path1 = createFile("path/to/" + resourceId).toString(); String path2 = createFile("path/to/another/" + resourceId).toString(); config.attachFile(path1); expectedException.expect(IllegalArgumentException.class); config.attachFile(path2); }
@Test public void when_attachNonexistentFileWithPath_then_throwsException() { String path = Paths.get("/i/do/not/exist").toString(); expectedException.expect(JetException.class); expectedException.expectMessage("Not an existing, readable file: " + path); config.attachFile(path); }
@Test public void when_attachNonexistentFileWithPathAndId_then_throwsException() { String id = "exist"; String path = Paths.get("/i/do/not/" + id).toString(); expectedException.expect(JetException.class); expectedException.expectMessage("Not an existing, readable file: " + path); config.attachFile(path, id); }
@Test public void when_attachNonexistentFileWithFile_then_throwsException() { String path = Paths.get("/i/do/not/exist").toString(); File file = new File(path); expectedException.expect(JetException.class); expectedException.expectMessage("Not an existing, readable file: " + path); config.attachFile(file); }
@Test public void when_attachNonexistentFileWithFileAndId_then_throwsException() { String id = "exist"; String path = Paths.get("/i/do/not/" + id).toString(); File file = new File(path); expectedException.expect(JetException.class); expectedException.expectMessage("Not an existing, readable file: " + path); config.attachFile(file, id); }
@Test public void when_attachDuplicateDirectoryWithPath_then_throwsException() { String path1 = createDirectory("path/to/dir").toString(); String path2 = createDirectory("path/to/another/dir").toString(); config.attachDirectory(path1); expectedException.expect(IllegalArgumentException.class); config.attachDirectory(path2); }