DBPediaPersonCandidateSupplier extends DBPediaCandidateSupplier<Person> { @Override public Collection<Candidate> getCandidates(EntityInformation<Person> entityInformation) { Collection<Person> people = entityInformation.getMentions(); Set<Candidate> candidates = new HashSet<>(); people.forEach( person -> { try { candidates.addAll(queryByNameContains(person.getValue())); } catch (ParseException e) { LOGGER.error(e.getMessage()); } }); return candidates; } DBPediaPersonCandidateSupplier(DBPediaService dbPediaService, int resultsLimit);  DBPediaPersonCandidateSupplier(); @Override Collection<Candidate> getCandidates(EntityInformation<Person> entityInformation);  }
@Test public void testGetCandidatesReturnsCandidates() { Collection<Candidate> candidates = dbPediaPersonCandidateSupplier.getCandidates(mockEntityInformation); assertEquals("Should be 2 candidates", 2, candidates.size()); }
@Test @SuppressWarnings("unchecked") public void testNoErrorForEmtityInformation() { Collection<Candidate> candidates = dbPediaPersonCandidateSupplier.getCandidates(mock(EntityInformation.class)); assertTrue(candidates.isEmpty()); }