@Test public void shouldThrowIfFilenameIncludesPath() { IllegalArgumentException caughtException = null; try { TandemFilename.join("a/b/c", ".gz"); } catch (IllegalArgumentException ex) { caughtException = ex; } assertNotNull("a/b/c is not a valid argument", caughtException); }
public static String join(String filename, String asciiExtension) { File file = new File(filename); if (file.getParent() != null) { throw new IllegalArgumentException("filename can't have parent"); } if (filename.length() * 4 + asciiExtension.length() <= MAX_CAT_BYTES) { return filename + asciiExtension; } return maybePackSha(filename, asciiExtension); }
TandemFilename { public static String join(String filename, String asciiExtension) { File file = new File(filename); if (file.getParent() != null) { throw new IllegalArgumentException("filename can't have parent"); } if (filename.length() * 4 + asciiExtension.length() <= MAX_CAT_BYTES) { return filename + asciiExtension; } return maybePackSha(filename, asciiExtension); } }
TandemFilename { public static String join(String filename, String asciiExtension) { File file = new File(filename); if (file.getParent() != null) { throw new IllegalArgumentException("filename can't have parent"); } if (filename.length() * 4 + asciiExtension.length() <= MAX_CAT_BYTES) { return filename + asciiExtension; } return maybePackSha(filename, asciiExtension); } private  TandemFilename(); }
TandemFilename { public static String join(String filename, String asciiExtension) { File file = new File(filename); if (file.getParent() != null) { throw new IllegalArgumentException("filename can't have parent"); } if (filename.length() * 4 + asciiExtension.length() <= MAX_CAT_BYTES) { return filename + asciiExtension; } return maybePackSha(filename, asciiExtension); } private  TandemFilename(); static String join(String filename, String asciiExtension); }
TandemFilename { public static String join(String filename, String asciiExtension) { File file = new File(filename); if (file.getParent() != null) { throw new IllegalArgumentException("filename can't have parent"); } if (filename.length() * 4 + asciiExtension.length() <= MAX_CAT_BYTES) { return filename + asciiExtension; } return maybePackSha(filename, asciiExtension); } private  TandemFilename(); static String join(String filename, String asciiExtension);  }