List of usage examples for org.apache.commons.collections CollectionUtils exists
public static boolean exists(Collection collection, Predicate predicate)
From source file:com.mylife.hbase.mapper.HBaseEntityMapper.java
/** * Constructor: Sets up hTablePool and scans base package paths looking for classes annotated with @HBasePersistance * //ww w .ja v a 2 s . co m * @param hTablePool * @param basePackages */ @SuppressWarnings("unchecked") public HBaseEntityMapper(HTablePool hTablePool, String... basePackages) { final HBaseAdmin hBaseAdmin; try { hBaseAdmin = new HBaseAdmin((Configuration) Whitebox.getInternalState(hTablePool, "config")); } catch (IOException e) { LOG.fatal("Could not connect to HBase failing HBase object mapping!", e); this.hTablePool = null; this.annotatedClassToAnnotatedHBaseRowKey = null; this.annotatedClassToAnnotatedFieldMappingWithCorrespondingGetterMethod = null; this.annotatedClassToAnnotatedObjectFieldMappingWithCorrespondingGetterMethod = null; this.annotatedClassToAnnotatedMapFieldMappingWithCorrespondingGetterMethod = null; return; } this.hTablePool = hTablePool; final Map<Class<?>, AccessibleObject> annotatedClassToAnnotatedHBaseRowKeyMap = new HashMap<Class<?>, AccessibleObject>(); final Map<Class<?>, ImmutableMap<Field, Method>> annotatedClassToAnnotatedFieldMappingWithCorrespondingGetterMethodMap = new HashMap<Class<?>, ImmutableMap<Field, Method>>(); final Map<Class<?>, ImmutableMap<Field, Method>> annotatedClassToAnnotatedObjectFieldMappingWithCorrespondingGetterMethodMap = new HashMap<Class<?>, ImmutableMap<Field, Method>>(); final Map<Class<?>, ImmutableMap<Field, Method>> annotatedClassToAnnotatedMapFieldMappingWithCorrespondingGetterMethodMap = new HashMap<Class<?>, ImmutableMap<Field, Method>>(); /* * Only include classes annotated with @HBasePersistance */ scanner.addIncludeFilter(new AnnotationTypeFilter(HBasePersistance.class)); for (final String basePackage : basePackages) { for (final BeanDefinition beanDefinition : scanner.findCandidateComponents(basePackage)) { final Class<?> annotatedClass; try { annotatedClass = Class.forName(beanDefinition.getBeanClassName()); } catch (ClassNotFoundException e) { // should never happen LOG.error("ClassNotFoundException while loading class for HBase entity mapper", e); throw new RuntimeException(e); } /* * Get the hbase table name - required! */ final String tableName = annotatedClass.getAnnotation(HBasePersistance.class).tableName(); if (StringUtils.isEmpty(tableName)) { LOG.error("@HBasePersistance must have a non-empty tableName. Ignoring: " + annotatedClass); continue; } try { if (!hBaseAdmin.tableExists(tableName)) { LOG.error("table " + tableName + " in @HBasePersistance.tableName() does not exist. Ignoring: " + annotatedClass); continue; } } catch (IOException e) { LOG.error("Could not verify table " + tableName + "in @HBasePersistance.tableName() exists. Ignoring: " + annotatedClass, e); continue; } /* * Get the default hbase column family name. This will be used as default column family where fields are * mapped to but not required if all annotated fields specifically mention the column family they belong * to. * * TODO: Current implementation makes this field required but it really isn't based on my * comment made previously. That is, if all annotated fields specifically mention the column family * where they will be found then a default column family name is unneeded. */ final String defaultColumnFamilyName = annotatedClass.getAnnotation(HBasePersistance.class) .defaultColumnFamilyName(); if (StringUtils.isEmpty(defaultColumnFamilyName)) { LOG.error("@HBasePersistance must have a non-empty defaultColumnFamilyName. Ignoring: " + annotatedClass); continue; } try { /* * Confirm the hbase table and column family exists */ if (!hBaseAdmin.getTableDescriptor(Bytes.toBytes(tableName)) .hasFamily(Bytes.toBytes(defaultColumnFamilyName))) { LOG.error("defaultColumnFamilyName (" + defaultColumnFamilyName + ") in " + tableName + "in @HBasePersistance.defaultColumnFamilyName() does not exist. Ignoring: " + annotatedClass); continue; } } catch (IOException e) { LOG.error("Could not verify defaultColumnFamilyName (" + defaultColumnFamilyName + ") in " + tableName + "in @HBasePersistance.defaultColumnFamilyName() exists. Ignoring: " + annotatedClass, e); continue; } /* * @HBaseField : Find fields with this annotation and their corresponding getter method */ Set<Field> hBaseFieldAnnotatedFieldsSet = Whitebox .getFieldsAnnotatedWith(Whitebox.newInstance(annotatedClass), HBaseField.class); /* * Use a Predicate to look through all @HBaseField annotated fields and skip whole class if even one * field is not supported */ if (CollectionUtils.exists(hBaseFieldAnnotatedFieldsSet, new org.apache.commons.collections.Predicate() { @Override public boolean evaluate(Object object) { return !TypeHandler.supports(((Field) object).getType()); } })) { LOG.error("Unsupported type annotated with @HBaseField. Ignoring: " + annotatedClass); continue; } annotatedClassToAnnotatedFieldMappingWithCorrespondingGetterMethodMap.put(annotatedClass, fieldsToGetterMap(annotatedClass, ImmutableSet.copyOf(hBaseFieldAnnotatedFieldsSet))); /* * @HBaseObjectField : Find all fields with this annotation and their corresponding getter method */ annotatedClassToAnnotatedObjectFieldMappingWithCorrespondingGetterMethodMap.put(annotatedClass, fieldsToGetterMap(annotatedClass, ImmutableSet.copyOf(Whitebox.getFieldsAnnotatedWith( Whitebox.newInstance(annotatedClass), HBaseObjectField.class)))); /* * @HBaseMapField : See if this annotation exists and if so, make sure there is only one */ final Set<Field> hBaseMapFieldAnnotatedFieldsSet = Whitebox .getFieldsAnnotatedWith(Whitebox.newInstance(annotatedClass), HBaseMapField.class); if (hBaseMapFieldAnnotatedFieldsSet.size() > 1) { LOG.error( "@HBaseMapField can only be used on one field per class. Ignoring: " + annotatedClass); continue; } final Iterator<Field> hBaseMapFieldsIterator = hBaseMapFieldAnnotatedFieldsSet.iterator(); if (hBaseMapFieldsIterator.hasNext()) { final Field field = hBaseMapFieldsIterator.next(); final Type[] types = TypeHandler.getGenericTypesFromField(field); if ((Modifier.isAbstract(field.getType().getModifiers()) && !Map.class.equals(field.getType())) || !Map.class.isAssignableFrom(field.getType()) || !String.class.equals((Class<?>) types[0]) || !String.class.equals((Class<?>) types[1])) { LOG.error( "@HBaseMapField must be used on a field of type java.util.Map<String, String> OR a concrete fields assignable from java.util.Map<String, String> . Ignoring: " + annotatedClass); continue; } annotatedClassToAnnotatedMapFieldMappingWithCorrespondingGetterMethodMap.put(annotatedClass, fieldsToGetterMap(annotatedClass, ImmutableSet.copyOf(hBaseMapFieldAnnotatedFieldsSet))); } /* * Figure out which method or field to use as the HBaseRowKey this has to be at the end since * * @HBaseRowKey is required in the class we can use this to key the other maps we are collecting */ final Set<Field> hBaseRowKeyFields = Whitebox .getFieldsAnnotatedWith(Whitebox.newInstance(annotatedClass), HBaseRowKey.class); if (hBaseRowKeyFields.size() > 1) { LOG.error("@HBaseRowKey can only be used once per class. Ignoring: " + annotatedClass); continue; } final Collection<Method> hBaseRowKeyMethods = Collections2.filter( Arrays.asList(ReflectionUtils.getAllDeclaredMethods(annotatedClass)), new Predicate<Method>() { @Override public boolean apply(final Method method) { return method.getAnnotation(HBaseRowKey.class) != null; } }); if (hBaseRowKeyFields.size() + hBaseRowKeyMethods.size() > 1) { LOG.error("@HBaseRowKey can only be used once per class. Ignoring: " + annotatedClass); continue; } if (hBaseRowKeyFields.size() + hBaseRowKeyMethods.size() == 0) { LOG.error("@HBaseRowKey is required. Ignoring: " + annotatedClass); continue; } if (hBaseRowKeyFields.isEmpty()) { final Method hBaseRowKeyMethod = hBaseRowKeyMethods.iterator().next(); if (hBaseRowKeyMethod.getParameterTypes().length > 0) { LOG.error("@HBaseRowKey can only be used on a no arguemnt method. Ignoring: " + annotatedClass); continue; } annotatedClassToAnnotatedHBaseRowKeyMap.put(annotatedClass, hBaseRowKeyMethod); } else { annotatedClassToAnnotatedHBaseRowKeyMap.put(annotatedClass, hBaseRowKeyFields.iterator().next()); } } } /* * keep only the valid classed in our maps */ annotatedClassToAnnotatedFieldMappingWithCorrespondingGetterMethodMap.keySet() .retainAll(annotatedClassToAnnotatedHBaseRowKeyMap.keySet()); annotatedClassToAnnotatedObjectFieldMappingWithCorrespondingGetterMethodMap.keySet() .retainAll(annotatedClassToAnnotatedHBaseRowKeyMap.keySet()); annotatedClassToAnnotatedMapFieldMappingWithCorrespondingGetterMethodMap.keySet() .retainAll(annotatedClassToAnnotatedHBaseRowKeyMap.keySet()); // set our state this.annotatedClassToAnnotatedHBaseRowKey = ImmutableMap.copyOf(annotatedClassToAnnotatedHBaseRowKeyMap); this.annotatedClassToAnnotatedFieldMappingWithCorrespondingGetterMethod = ImmutableMap .copyOf(annotatedClassToAnnotatedFieldMappingWithCorrespondingGetterMethodMap); this.annotatedClassToAnnotatedObjectFieldMappingWithCorrespondingGetterMethod = ImmutableMap .copyOf(annotatedClassToAnnotatedObjectFieldMappingWithCorrespondingGetterMethodMap); this.annotatedClassToAnnotatedMapFieldMappingWithCorrespondingGetterMethod = ImmutableMap .copyOf(annotatedClassToAnnotatedMapFieldMappingWithCorrespondingGetterMethodMap); }
From source file:net.sf.wickedshell.facade.descriptor.ExtensionShellDescriptor.java
/** * @see net.sf.wickedshell.facade.descriptor.IShellDescriptor#isExecutable(java.io.File) *//*from w w w. j a v a 2s. c om*/ public boolean isExecutable(final File file) { return CollectionUtils.exists(Arrays.asList(executableFiles), new Predicate() { /** * @see org.apache.commons.collections.Predicate#evaluate(java.lang.Object) */ public boolean evaluate(Object object) { IExecutableFile executableFile = (IExecutableFile) object; return file.getName().endsWith(executableFile.getExtension()); } }); }
From source file:com.cyberway.issue.crawler.extractor.ExtractorHTMLTest.java
/** * Test a whitespace issue found in href. * // w w w . j a v a 2s .c om * See [ 963965 ] Either UURI or ExtractHTML should strip whitespace better. * https://sourceforge.net/tracker/?func=detail&atid=539099&aid=963965&group_id=73833 * * @throws URIException */ public void testHrefWhitespace() throws URIException { CrawlURI curi = new CrawlURI(UURIFactory.getInstance("http://www.carsound.dk")); CharSequence cs = "<a href=\"http://www.carsound.dk\n\n\n" + "\"\ntarget=\"_blank\">C.A.R. Sound\n\n\n\n</a>"; this.extractor.extract(curi, cs); curi.getOutLinks(); assertTrue("Not stripping new lines", CollectionUtils.exists(curi.getOutLinks(), new Predicate() { public boolean evaluate(Object object) { return ((Link) object).getDestination().toString().indexOf("http://www.carsound.dk/") >= 0; } })); }
From source file:net.sf.wickedshell.facade.descriptor.ExtensionShellDescriptor.java
/** * @see net.sf.wickedshell.facade.descriptor.IShellDescriptor#isAllowedForBatchList(java.io.File) *///w w w .j a v a 2 s.com public boolean isAllowedForBatchList(final File file) { return CollectionUtils.exists(Arrays.asList(executableFiles), new Predicate() { /** * @see org.apache.commons.collections.Predicate#evaluate(java.lang.Object) */ public boolean evaluate(Object object) { IExecutableFile executableFile = (IExecutableFile) object; return executableFile.isBatchFile() && file.getName().endsWith(executableFile.getExtension()); } }); }
From source file:net.sf.wickedshell.facade.descriptor.ExtensionShellDescriptor.java
/** * @see net.sf.wickedshell.facade.descriptor.IShellDescriptor#isCurrentOSSupported() *//*from w w w. j a va2s .com*/ public boolean isCurrentOSSupported() { final String operatingSystem = System.getProperty(ShellID.OS_KEY); return CollectionUtils.exists(Arrays.asList(this.supportingOperatingSystems), new Predicate() { /** * @see org.apache.commons.collections.Predicate#evaluate(java.lang.Object) */ public boolean evaluate(Object object) { String supportingOperatingSystem = (String) object; return supportingOperatingSystem.equalsIgnoreCase(operatingSystem); } }); }
From source file:com.cyberway.issue.crawler.extractor.ExtractorHTMLTest.java
/** * Test that relative URIs with late colons aren't misinterpreted * as absolute URIs with long, illegal scheme components. * //from ww w.j a v a2s . c o m * See http://webteam.archive.org/jira/browse/HER-1268 * * @throws URIException */ public void testBadRelativeLinks() throws URIException { CrawlURI curi = new CrawlURI(UURIFactory.getInstance("http://www.example.com")); CharSequence cs = "<a href=\"example.html;jsessionid=deadbeef:deadbeed?parameter=this:value\"/>" + "<a href=\"example.html?parameter=this:value\"/>"; this.extractor.extract(curi, cs); assertTrue(CollectionUtils.exists(curi.getOutLinks(), new Predicate() { public boolean evaluate(Object object) { return ((Link) object).getDestination().toString() .indexOf("/example.html;jsessionid=deadbeef:deadbeed?parameter=this:value") >= 0; } })); assertTrue(CollectionUtils.exists(curi.getOutLinks(), new Predicate() { public boolean evaluate(Object object) { return ((Link) object).getDestination().toString() .indexOf("/example.html?parameter=this:value") >= 0; } })); }
From source file:com.perceptive.epm.perkolcentral.bl.ExcelReportBL.java
public FileInputStream generateLicenseReport(File file) throws ExceptionWrapper { try {//from w ww . ja v a 2 s.c o m FileInputStream inp = new FileInputStream(file); //InputStream inp = new FileInputStream("workbook.xlsx"); Workbook wb = WorkbookFactory.create(inp); HashMap<String, ArrayList<String>> licenseInfoKeyedByLicenseName = licensesBL.getLicenseRelatedInfo(); //Create The Summary Sheet Sheet sheetSummary = wb.getSheetAt(1); int iSummaryRowCounter = 1; for (String licenseType : licenseInfoKeyedByLicenseName.keySet()) { Row row = sheetSummary.getRow(iSummaryRowCounter); if (row == null) row = sheetSummary.createRow(iSummaryRowCounter); Cell cell = row.getCell(0); if (cell == null) cell = row.createCell(0); setCellBorder(wb, cell); cell.setCellValue(licenseType); row = sheetSummary.getRow(iSummaryRowCounter); if (row == null) row = sheetSummary.createRow(iSummaryRowCounter); cell = row.getCell(1); if (cell == null) cell = row.createCell(1); setCellBorder(wb, cell); cell.setCellValue(Double.parseDouble(licenseInfoKeyedByLicenseName.get(licenseType).get(0))); cell.setCellType(Cell.CELL_TYPE_NUMERIC); row = sheetSummary.getRow(iSummaryRowCounter); if (row == null) row = sheetSummary.createRow(iSummaryRowCounter); cell = row.getCell(2); if (cell == null) cell = row.createCell(2); setCellBorder(wb, cell); cell.setCellValue(Double.parseDouble(licenseInfoKeyedByLicenseName.get(licenseType).get(1))); cell.setCellType(Cell.CELL_TYPE_NUMERIC); row = sheetSummary.getRow(iSummaryRowCounter); if (row == null) row = sheetSummary.createRow(iSummaryRowCounter); cell = row.getCell(3); if (cell == null) cell = row.createCell(3); setCellBorder(wb, cell); cell.setCellValue(Double.parseDouble(licenseInfoKeyedByLicenseName.get(licenseType).get(0)) - Double.parseDouble(licenseInfoKeyedByLicenseName.get(licenseType).get(1))); cell.setCellType(Cell.CELL_TYPE_NUMERIC); iSummaryRowCounter = iSummaryRowCounter + 1; } int iSheetCounter = 1; for (String licenseType : licenseInfoKeyedByLicenseName.keySet()) { Sheet sheet = wb.cloneSheet(0); wb.setSheetName(wb.getSheetIndex(sheet), licenseType); CellReference cellReference = new CellReference("B1"); Row row = sheet.getRow(cellReference.getRow()); Cell cell = row.getCell(cellReference.getCol()); if (cell == null) cell = row.createCell(cellReference.getCol()); setCellBorder(wb, cell); cell.setCellValue(Double.parseDouble(licenseInfoKeyedByLicenseName.get(licenseType).get(0))); cell.setCellType(Cell.CELL_TYPE_NUMERIC); cellReference = new CellReference("B2"); row = sheet.getRow(cellReference.getRow()); cell = row.getCell(cellReference.getCol()); if (cell == null) cell = row.createCell(cellReference.getCol()); setCellBorder(wb, cell); cell.setCellValue(Double.parseDouble(licenseInfoKeyedByLicenseName.get(licenseType).get(1))); cell.setCellType(Cell.CELL_TYPE_NUMERIC); cellReference = new CellReference("B3"); row = sheet.getRow(cellReference.getRow()); cell = row.getCell(cellReference.getCol()); if (cell == null) cell = row.createCell(cellReference.getCol()); setCellBorder(wb, cell); cell.setCellValue(Double.parseDouble(licenseInfoKeyedByLicenseName.get(licenseType).get(0)) - Double.parseDouble(licenseInfoKeyedByLicenseName.get(licenseType).get(1))); cell.setCellType(Cell.CELL_TYPE_NUMERIC); ArrayList<EmployeeBO> allEmployees = new ArrayList<EmployeeBO>( employeeBL.getAllEmployees().values()); final String selectedLicenseTypeName = licenseType; CollectionUtils.filter(allEmployees, new Predicate() { @Override public boolean evaluate(Object o) { EmployeeBO emp = (EmployeeBO) o; if (CollectionUtils.exists(emp.getLicenses(), new Predicate() { @Override public boolean evaluate(Object o) { return ((LicenseBO) o).getLicenseTypeName() .equalsIgnoreCase(selectedLicenseTypeName); //To change body of implemented methods use File | Settings | File Templates. } })) return true; else return false; } }); int iRowCounter = 5; for (EmployeeBO employeeBO : allEmployees) { row = sheet.getRow(iRowCounter); if (row == null) row = sheet.createRow(iRowCounter); cell = row.getCell(0); if (cell == null) cell = row.createCell(0); setCellBorder(wb, cell); cell.setCellValue(employeeBO.getEmployeeId()); cell = row.getCell(1); if (cell == null) cell = row.createCell(1); setCellBorder(wb, cell); cell.setCellValue(employeeBO.getEmployeeUid()); cell = row.getCell(2); if (cell == null) cell = row.createCell(2); setCellBorder(wb, cell); cell.setCellValue(employeeBO.getEmployeeName()); cell = row.getCell(3); if (cell == null) cell = row.createCell(3); setCellBorder(wb, cell); cell.setCellValue(employeeBO.getEmail()); cell = row.getCell(4); if (cell == null) cell = row.createCell(4); setCellBorder(wb, cell); cell.setCellValue(employeeBO.getManager()); cell = row.getCell(5); if (cell == null) cell = row.createCell(5); setCellBorder(wb, cell); cell.setCellValue(employeeBO.getMobileNumber()); cell = row.getCell(6); if (cell == null) cell = row.createCell(6); setCellBorder(wb, cell); cell.setCellValue(employeeBO.getExtensionNum()); cell = row.getCell(7); if (cell == null) cell = row.createCell(7); setCellBorder(wb, cell); cell.setCellValue(employeeBO.getWorkspace()); iRowCounter = iRowCounter + 1; } } iSheetCounter = iSheetCounter + 1; wb.removeSheetAt(0); FileOutputStream fileOut = new FileOutputStream(file); wb.write(fileOut); fileOut.close(); return new FileInputStream(file); } catch (Exception ex) { throw new ExceptionWrapper(ex); } }
From source file:com.perceptive.epm.perkolcentral.action.ajax.EmployeeDetailsAction.java
public String executeEmployeesByTeamAjax() throws ExceptionWrapper { try {// w ww.j a v a 2 s.c om LoggingHelpUtil.printDebug("Page " + getPage() + " Rows " + getRows() + " Sorting Order " + getSord() + " Index Row :" + getSidx()); LoggingHelpUtil.printDebug("Search :" + searchField + " " + searchOper + " " + searchString); // Calcalate until rows ware selected int to = (rows * page); // Calculate the first row to read int from = to - rows; LinkedHashMap<Long, EmployeeBO> employeeLinkedHashMap = new LinkedHashMap<Long, EmployeeBO>(); employeeLinkedHashMap = employeeBL.getAllEmployees(); ArrayList<EmployeeBO> allEmployees = new ArrayList<EmployeeBO>(employeeLinkedHashMap.values()); CollectionUtils.filter(allEmployees, new Predicate() { @Override public boolean evaluate(Object o) { EmployeeBO emp = (EmployeeBO) o; if (CollectionUtils.exists(emp.getGroups(), new Predicate() { @Override public boolean evaluate(Object o) { return ((GroupBO) o).getGroupId().equalsIgnoreCase(selectedGroupId); //To change body of implemented methods use File | Settings | File Templates. } })) return true; else return false; } }); //// Handle Order By if (sidx != null && !sidx.equals("")) { Collections.sort(allEmployees, new Comparator<EmployeeBO>() { public int compare(EmployeeBO e1, EmployeeBO e2) { if (sidx.equalsIgnoreCase("employeeName")) return sord.equalsIgnoreCase("asc") ? e1.getEmployeeName().compareTo(e2.getEmployeeName()) : e2.getEmployeeName().compareTo(e1.getEmployeeName()); else if (sidx.equalsIgnoreCase("jobTitle")) return sord.equalsIgnoreCase("asc") ? e1.getJobTitle().compareTo(e2.getJobTitle()) : e2.getJobTitle().compareTo(e1.getJobTitle()); else if (sidx.equalsIgnoreCase("manager")) return sord.equalsIgnoreCase("asc") ? e1.getManager().compareTo(e2.getManager()) : e2.getManager().compareTo(e1.getManager()); else return sord.equalsIgnoreCase("asc") ? e1.getEmployeeName().compareTo(e2.getEmployeeName()) : e2.getEmployeeName().compareTo(e1.getEmployeeName()); } }); } // records = allEmployees.size(); total = (int) Math.ceil((double) records / (double) rows); gridModel = new ArrayList<EmployeeBO>(); to = to > records ? records : to; for (int iCounter = from; iCounter < to; iCounter++) { EmployeeBO employeeBO = allEmployees.get(iCounter); //new EmployeeBO((Employee) employeeLinkedHashMap.values().toArray()[iCounter]); gridModel.add(employeeBO); } } catch (Exception ex) { throw new ExceptionWrapper(ex); } return SUCCESS; }
From source file:gov.nih.nci.firebird.web.action.investigator.registration.RegistrationTabAction.java
/** * @return if there are any expired credentials in the profile. *//*from w w w. j a v a 2 s.c o m*/ @SuppressWarnings("ucd") // called from JSP pages public boolean profileContainsExpiredCredentials() { InvestigatorProfile profile = getRegistration().getProfile(); return CollectionUtils.exists(profile.getCredentials(), new Predicate() { @Override public boolean evaluate(Object object) { AbstractCredential<?> credential = (AbstractCredential<?>) object; return credential.isExpired(); } }); }
From source file:com.cyberway.issue.crawler.extractor.ExtractorHTMLTest.java
/** * Test if scheme is maintained by speculative hops onto exact * same host// w ww .ja v a 2 s .c o m * * [HER-1524] speculativeFixup in ExtractorJS should maintain URL scheme */ public void testSpeculativeLinkExtraction() throws URIException { CrawlURI curi = new CrawlURI(UURIFactory.getInstance("https://www.example.com")); CharSequence cs = "<script type=\"text/javascript\">_parameter=\"www.anotherexample.com\";" + "_anotherparameter=\"www.example.com/index.html\"" + ";</script>"; this.extractor.extract(curi, cs); assertTrue(CollectionUtils.exists(curi.getOutLinks(), new Predicate() { public boolean evaluate(Object object) { return ((Link) object).getDestination().toString().equals("http://www.anotherexample.com/"); } })); assertTrue(CollectionUtils.exists(curi.getOutLinks(), new Predicate() { public boolean evaluate(Object object) { return ((Link) object).getDestination().toString().equals("https://www.example.com/index.html"); } })); }