};
}
+ @Test(
+ groups = "Functional",
+ dataProvider = "stringFilenamesBaseAndExtensionsData")
+ public void stringGetBaseAndExtensionTest(String filename,
+ String extension, String base)
+ {
+ String thisBase = FileUtils.getBase(filename);
+ Assert.assertEquals(thisBase, base,
+ "base part of path and filename not as expected");
+ String thisExtension = FileUtils.getExtension(filename);
+ Assert.assertEquals(thisExtension, extension,
+ "extension part of filename not as expected");
+ }
+
+ @DataProvider(name = "stringFilenamesBaseAndExtensionsData")
+ public Object[][] stringFilenamesBaseAndExtensionsData()
+ {
+ return new Object[][] {
+ /*
+ * String full URL or path
+ * String base the above but without the extension if there is one
+ * String extension the filename extension if there is one
+ */
+ /*
+ */
+ { "/examples/uniref50.fa", "fa", "/examples/uniref50." },
+ { "/examples/uniref50", null, "/examples/uniref50" },
+ { "/examples/.uniref50", null, "/examples/.uniref50" },
+ { "/exampl.es/uniref50", null, "/exampl.es/uniref50" },
+ { "/examples/uniref50.", "", "/examples/uniref50." },
+ { "examples/uniref50.fa", "fa", "examples/uniref50." },
+ { "examples/uniref50", null, "examples/uniref50" },
+ { "examples/.uniref50", null, "examples/.uniref50" },
+ { "exampl.es/uniref50", null, "exampl.es/uniref50" },
+ { "examples/uniref50.", "", "examples/uniref50." },
+ { "https://www.jalview.org:443/examples/uniref50.fa", "fa",
+ "https://www.jalview.org:443/examples/uniref50." },
+ { "https://www.jalview.org:443/examples/uniref50", null,
+ "https://www.jalview.org:443/examples/uniref50" },
+ { "https://www.jalview.org:443/examples/.uniref50", null,
+ "https://www.jalview.org:443/examples/.uniref50" },
+ { "https://www.jalview.org:443/exampl.es/uniref50", null,
+ "https://www.jalview.org:443/exampl.es/uniref50" },
+ { "https://www.jalview.org:443/examples/uniref50.", "",
+ "https://www.jalview.org:443/examples/uniref50." },
+ /*
+ */
+ //
+ };
+ }
}