@Test public void doesOverwriteANonStudentFile() { assertTrue(decider.shouldUnzip("/project/NotAStudentFile.txt")); }
@Override public boolean shouldUnzip(String filePath) { for (String s : doNotUnzip) { if (s.charAt(s.length() - 1) == '/') { s = s.substring(0, s.length() - 1); } s = (project.getRootPath() + "/" + s); if (filePath.startsWith(s) && (filePath.equals(s) || filePath.charAt(s.length()) == '/')) { return false; } } return true; }
AbstractUnzippingDecider implements UnzippingDecider { @Override public boolean shouldUnzip(String filePath) { for (String s : doNotUnzip) { if (s.charAt(s.length() - 1) == '/') { s = s.substring(0, s.length() - 1); } s = (project.getRootPath() + "/" + s); if (filePath.startsWith(s) && (filePath.equals(s) || filePath.charAt(s.length()) == '/')) { return false; } } return true; } }
AbstractUnzippingDecider implements UnzippingDecider { @Override public boolean shouldUnzip(String filePath) { for (String s : doNotUnzip) { if (s.charAt(s.length() - 1) == '/') { s = s.substring(0, s.length() - 1); } s = (project.getRootPath() + "/" + s); if (filePath.startsWith(s) && (filePath.equals(s) || filePath.charAt(s.length()) == '/')) { return false; } } return true; } AbstractUnzippingDecider(IOFactory io, Project project); }
AbstractUnzippingDecider implements UnzippingDecider { @Override public boolean shouldUnzip(String filePath) { for (String s : doNotUnzip) { if (s.charAt(s.length() - 1) == '/') { s = s.substring(0, s.length() - 1); } s = (project.getRootPath() + "/" + s); if (filePath.startsWith(s) && (filePath.equals(s) || filePath.charAt(s.length()) == '/')) { return false; } } return true; } AbstractUnzippingDecider(IOFactory io, Project project); @Override boolean shouldUnzip(String filePath); }
AbstractUnzippingDecider implements UnzippingDecider { @Override public boolean shouldUnzip(String filePath) { for (String s : doNotUnzip) { if (s.charAt(s.length() - 1) == '/') { s = s.substring(0, s.length() - 1); } s = (project.getRootPath() + "/" + s); if (filePath.startsWith(s) && (filePath.equals(s) || filePath.charAt(s.length()) == '/')) { return false; } } return true; } AbstractUnzippingDecider(IOFactory io, Project project); @Override boolean shouldUnzip(String filePath);  }