DBPediaLocationCandidateSupplier extends DBPediaCandidateSupplier<Location> { @Override public Collection<Candidate> getCandidates(EntityInformation<Location> entityInformation) { Collection<Location> locations = entityInformation.getMentions(); Collection<Candidate> candidates = new HashSet<>(); for (Location location : locations) { try { candidates.addAll(queryByNameContains(location.getValue())); } catch (ParseException e) { LOGGER.error(e.getMessage()); } } return candidates; } DBPediaLocationCandidateSupplier(DBPediaService dbPediaService, int resultsLimit);  DBPediaLocationCandidateSupplier(); @Override Collection<Candidate> getCandidates(EntityInformation<Location> entityInformation); static final String LOCATION_ID_FIELD; static final String NAME_FIELD; }
@Test public void testCandidatesAreReturned() { Collection<Candidate> candidates = dbPediaLocationCandidateSupplier.getCandidates(mockEntityInformation); assertEquals("Should return 2 candidates", 2, candidates.size()); }
@Test @SuppressWarnings("unchecked") public void testNoErrorForEmtityInformation() { Collection<Candidate> candidates = dbPediaLocationCandidateSupplier.getCandidates(mock(EntityInformation.class)); assertTrue(candidates.isEmpty()); }