CveSearchApiImpl implements CveSearchApi { @Override public List<CveSearchData> search(String vendor, String product) throws IOException { Function<String,String> unifyer = s -> { if(Strings.isNullOrEmpty(s)) { return CVE_SEARCH_WILDCARD; } return CommonUtils.nullToEmptyString(s).replace(" ", "_").toLowerCase(); }; String query = composeQuery(CVE_SEARCH_SEARCH, unifyer.apply(vendor), unifyer.apply(product)); return getParsedCveSearchDatas(query); } CveSearchApiImpl(String host); @Override List<CveSearchData> search(String vendor, String product); @Override List<CveSearchData> cvefor(String cpe); @Override CveSearchData cve(String cve); @Override List<String> allVendorNames(); @Override List<String> allProductsOfVendor(String vendorName); public String CVE_SEARCH_WILDCARD; }
@Test public void exactSearchTest() throws IOException { List<CveSearchData> result; result = cveSearchApi.search(VENDOR,PRODUCT); assert(result != null); }