Documentation { public List<String> applicableFunctions(ItemDocumentation itemDocumentation) { List<String> result = new ArrayList<String>(); List<String> ids = itemDocumentation.getFunctionNames(); if (ids != null) { for (String id : ids) { if (FUNCTION_MAPPING.containsKey(id)) { result.add(FUNCTION_MAPPING.get(id)); } } } return result; }  boolean isSupported(ItemDocumentation itemDocumentation); List<String> applicableFunctions(ItemDocumentation itemDocumentation); List<FunctionDocumentation> getAllFunctionDocumentation(); FunctionDocumentation getAddressDocumentation(); FunctionDocumentation getBblDocumentation(); FunctionDocumentation getBinDocumentation(); FunctionDocumentation getBlockfaceDocumentation(); DataDictionary getDataDictionary(); FunctionDocumentation getIntersectionDocumentation(); FunctionDocumentation getPlaceDocumentation(); void setAddressDocumentation(FunctionDocumentation addressDocumentation); void setBblDocumentation(FunctionDocumentation bblDocumentation); void setBinDocumentation(FunctionDocumentation binDocumentation); void setBlockfaceDocumentation(FunctionDocumentation blockfaceDocumentation); void setDataDictionary(DataDictionary dataDictionary); void setIntersectionDocumentation(FunctionDocumentation intersectionDocumentation); void setPlaceDocumentation(FunctionDocumentation placeDocumentation); static final String ADDRESS_FUNCTION; static final String BBL_FUNCTION; static final String BIN_FUNCTION; static final String BLOCKFACE_FUNCTION; static final String INTERSECTION_FUNCTION; static final String PLACE_FUNCTION; static final String ADDRESS_AND_PLACE_FUNCTIONS; static final Map<String, String> FUNCTION_MAPPING; }
@Test public void testApplicableFunctions() { List<String> ids = new ArrayList<String>(); ids.add(Function.F1A); ids.add(Function.F3); ids.add(Function.F2); ids.add(Function.FD); ids.add(Function.FDG); ids.add(Function.FDN); ids.add(Function.F1B); ids.add(Function.FBN); ids.add("bogus"); ids.add(Function.FBL); ItemDocumentation itemDocumentation = new ItemDocumentation(); assertTrue(documentation.applicableFunctions(itemDocumentation).isEmpty()); itemDocumentation.setFunctionNames(ids); List<String> result = documentation.applicableFunctions(itemDocumentation); assertEquals(Documentation.BLOCKFACE_FUNCTION, result.get(0)); assertEquals(Documentation.INTERSECTION_FUNCTION, result.get(1)); assertEquals(Documentation.ADDRESS_AND_PLACE_FUNCTIONS, result.get(2)); assertEquals(Documentation.BIN_FUNCTION, result.get(3)); assertEquals(Documentation.BBL_FUNCTION, result.get(4)); assertEquals(5, result.size()); }