BinnedFileFilter extends BeamFileFilter { public static boolean isBinnedName(String name) { return name != null && ((name.startsWith("ESACCI-OC-") && name.contains("L3")) || name.contains("-bins")) && name.endsWith(BinnedProductReaderPlugin.FILE_EXTENSION); } BinnedFileFilter(); @Override boolean accept(File file); static boolean isBinnedName(String name);  }
@Test public void testIsBinnedName_OC_CCI() { final String startsWith_oc_cci = "ESACCI-OC-"; final String mustContain_oc_cci = "L3"; final String any = "__any_text__"; assertEquals(false, BinnedFileFilter.isBinnedName("DoNotStartExpected" + any + mustContain_oc_cci + any + endsWith)); assertEquals(false, BinnedFileFilter.isBinnedName(startsWith_oc_cci + any + "doNotContainExpected" + any + endsWith)); assertEquals(false, BinnedFileFilter.isBinnedName(startsWith_oc_cci + any + mustContain_oc_cci + any + "endsNotWithExpected")); assertEquals(true, BinnedFileFilter.isBinnedName(startsWith_oc_cci + any + mustContain_oc_cci + any + endsWith)); }
@Test public void testIsBinnedName_BEAM_Binning() { final String mustContain_bins = "-bins"; assertEquals(false, BinnedFileFilter.isBinnedName("StartsWithAnything" + "doNotContain_bins" + "continuesWithAnything" + endsWith)); assertEquals(true, BinnedFileFilter.isBinnedName("StartsWithAnything" + mustContain_bins + "continuesWithAnything" + endsWith)); }