CountyResolver { public ValueResolution resolve(LocationTokens locationTokens) { ValueResolution valueResolution = new ValueResolution(); addUnmappedTokens(locationTokens, valueResolution); addMappedTokens(locationTokens, valueResolution); if(valueResolution.resolvedCount() == 0) { valueResolution.add(MANHATTAN); valueResolution.add(BRONX); valueResolution.add(BROOKLYN); valueResolution.add(QUEENS); valueResolution.add(STATEN_ISLAND); } return valueResolution; } @SafeVarargs  CountyResolver(Map<String, String>... mappings); ValueResolution resolve(LocationTokens locationTokens); static final InputValue MANHATTAN; static final InputValue BRONX; static final InputValue BROOKLYN; static final InputValue QUEENS; static final InputValue STATEN_ISLAND; }
@Test public void testResolve_emptyLocationTokensContainsFiveBoroughs() { ValueResolution res = boroughResolver.resolve(locationTokens); assertThat(res).isNotNull(); assertThat(res.unresolvedCount()).isEqualTo(0); assertThat(res.resolvedCount()).isEqualTo(5); assertThat(res.totalCount()).isEqualTo(5); assertTrue(res.resolved().contains(CountyResolver.MANHATTAN)); assertTrue(res.resolved().contains(CountyResolver.BRONX)); assertTrue(res.resolved().contains(CountyResolver.BROOKLYN)); assertTrue(res.resolved().contains(CountyResolver.QUEENS)); assertTrue(res.resolved().contains(CountyResolver.STATEN_ISLAND)); }