@Test public void setImagePrefixWithNonExistingFolder() { try { targetFactory.setImagePrefix(NODE_FOLDER + "_NON_EXISTING"); fail(); } catch (IllegalStateException e) { assertThat(e.getMessage(), containsString("does not exist")); } }
public void setImagePrefix(String imagePathPrefix) { String imageFolder = !imagePathPrefix.endsWith("/") ? imagePathPrefix + "/" : imagePathPrefix; this.folderToScan = new File(imageFolder); checkState(folderToScan.exists(), "Folder %s does not exist", folderToScan.getAbsolutePath()); checkState(folderToScan.isDirectory(), "Folder %s is not a folder", folderToScan.getAbsolutePath()); }
TargetFactory { public void setImagePrefix(String imagePathPrefix) { String imageFolder = !imagePathPrefix.endsWith("/") ? imagePathPrefix + "/" : imagePathPrefix; this.folderToScan = new File(imageFolder); checkState(folderToScan.exists(), "Folder %s does not exist", folderToScan.getAbsolutePath()); checkState(folderToScan.isDirectory(), "Folder %s is not a folder", folderToScan.getAbsolutePath()); } }
TargetFactory { public void setImagePrefix(String imagePathPrefix) { String imageFolder = !imagePathPrefix.endsWith("/") ? imagePathPrefix + "/" : imagePathPrefix; this.folderToScan = new File(imageFolder); checkState(folderToScan.exists(), "Folder %s does not exist", folderToScan.getAbsolutePath()); checkState(folderToScan.isDirectory(), "Folder %s is not a folder", folderToScan.getAbsolutePath()); }  }
TargetFactory { public void setImagePrefix(String imagePathPrefix) { String imageFolder = !imagePathPrefix.endsWith("/") ? imagePathPrefix + "/" : imagePathPrefix; this.folderToScan = new File(imageFolder); checkState(folderToScan.exists(), "Folder %s does not exist", folderToScan.getAbsolutePath()); checkState(folderToScan.isDirectory(), "Folder %s is not a folder", folderToScan.getAbsolutePath()); }  void setImagePrefix(String imagePathPrefix); ImageTarget createImageTarget(String imageFile); }
TargetFactory { public void setImagePrefix(String imagePathPrefix) { String imageFolder = !imagePathPrefix.endsWith("/") ? imagePathPrefix + "/" : imagePathPrefix; this.folderToScan = new File(imageFolder); checkState(folderToScan.exists(), "Folder %s does not exist", folderToScan.getAbsolutePath()); checkState(folderToScan.isDirectory(), "Folder %s is not a folder", folderToScan.getAbsolutePath()); }  void setImagePrefix(String imagePathPrefix); ImageTarget createImageTarget(String imageFile);  }