### Question:
LocationDetector implements CellDetector<LocationResults> { @Override public ValuesWithConfidence<LocationResults> detect(CellSampler sampler) { LocationResults aggregateResults = new LocationResults(); List<LocationDecider> deciders = LocationDeciderFactory.getInstance().buildDeciders(myPrefsRegistry); for (LocationDecider decider : deciders) { LocationResults results = decider.determineLocationColumns(sampler); List<LatLonColumnResults> latLonResults = results.getLatLonResults(); if (latLonResults != null && !latLonResults.isEmpty()) { for (LatLonColumnResults latLonResult : latLonResults) { if (latLonResult.getConfidence() > 0) { aggregateResults.addResult(latLonResult); } } } List<PotentialLocationColumn> locResults = results.getLocationResults(); if (locResults != null && !locResults.isEmpty()) { for (PotentialLocationColumn locResult : locResults) { if (locResult.getConfidence() > 0) { aggregateResults.addResult(locResult); } } } } LocationFormatDetector lfd = new LocationFormatDetector(); lfd.detectLocationColumnFormats(aggregateResults, sampler.getBeginningSampleCells()); return new ValuesWithConfidence<LocationResults>(aggregateResults, Math.max(0f, aggregateResults.getConfidence())); } LocationDetector(PreferencesRegistry prefsRegistry); @Override ValuesWithConfidence<LocationResults> detect(CellSampler sampler);  }### Answer:
@Test public void testAdvancedLocationData() { LocationDetector latlonDetector = new LocationDetector(LocationTestUtils.getPrefsRegistry()); Character delimiter = Character.valueOf(','); Character quote = Character.valueOf('"'); List<String> rows = CsvTestUtils.createMultipleDelimitedLatLonData(String.valueOf(delimiter)); ListCellSampler lcs = new ListCellSampler(rows, delimiter, quote); ValuesWithConfidence<LocationResults> result = latlonDetector.detect(lcs); Assert.assertEquals(1f, result.getBestValue().getConfidence(), 0f); }
@Test public void testMultipleDelimitedLocationData() { LocationDetector latlonDetector = new LocationDetector(LocationTestUtils.getPrefsRegistry()); Character delimiter = Character.valueOf(','); Character quote = Character.valueOf('"'); List<String> rows = CsvTestUtils.createMultipleDelimitedLocationData(String.valueOf(delimiter), quote); ListCellSampler lcs = new ListCellSampler(rows, delimiter, quote); ValuesWithConfidence<LocationResults> result = latlonDetector.detect(lcs); Assert.assertEquals(1f, result.getBestValue().getConfidence(), 0f); }
@Test public void testNoLocationData() { LocationDetector latlonDetector = new LocationDetector(LocationTestUtils.getPrefsRegistry()); Character delimiter = Character.valueOf(','); Character quote = Character.valueOf('"'); List<String> rows = CsvTestUtils.createNoLocationData(String.valueOf(delimiter)); ListCellSampler lcs = new ListCellSampler(rows, delimiter, quote); ValuesWithConfidence<LocationResults> result = latlonDetector.detect(lcs); Assert.assertEquals(0f, result.getBestValue().getConfidence(), 0f); }