@Test public void testInferFilename() throws Exception { assertEquals(FilenameProducers.inferFilename("myname.tgz"), "myname.tgz"); assertEquals(FilenameProducers.inferFilename("a/myname.tgz"), "myname.tgz"); assertEquals(FilenameProducers.inferFilename("acme.com/download/"), null); }
public static String inferFilename(String target) { String result = target.substring(target.lastIndexOf("/")+1); result = result.contains("?") ? result.substring(0, result.indexOf("?")) : result; if (!result.contains(".")) return null; return result; }
FilenameProducers { public static String inferFilename(String target) { String result = target.substring(target.lastIndexOf("/")+1); result = result.contains("?") ? result.substring(0, result.indexOf("?")) : result; if (!result.contains(".")) return null; return result; } }
FilenameProducers { public static String inferFilename(String target) { String result = target.substring(target.lastIndexOf("/")+1); result = result.contains("?") ? result.substring(0, result.indexOf("?")) : result; if (!result.contains(".")) return null; return result; }  }
FilenameProducers { public static String inferFilename(String target) { String result = target.substring(target.lastIndexOf("/")+1); result = result.contains("?") ? result.substring(0, result.indexOf("?")) : result; if (!result.contains(".")) return null; return result; }  static String inferFilename(String target); static Function<DownloadRequirement, String> fromFilenameProperty(); static Function<DownloadRequirement, String> firstPrimaryTargetOf(final Function<DownloadRequirement, DownloadTargets> producer); }
FilenameProducers { public static String inferFilename(String target) { String result = target.substring(target.lastIndexOf("/")+1); result = result.contains("?") ? result.substring(0, result.indexOf("?")) : result; if (!result.contains(".")) return null; return result; }  static String inferFilename(String target); static Function<DownloadRequirement, String> fromFilenameProperty(); static Function<DownloadRequirement, String> firstPrimaryTargetOf(final Function<DownloadRequirement, DownloadTargets> producer);  }