private void applySeparator() { if (separateNext) { builder.append("; "); } separateNext = false; }
void init() { builder.append("; ("); }
/** * Appends the string <i>way</i> to the current query. * * @return the current query object */ public OverpassFilterQuery way() { applySeparator(); builder.append("way"); return this; }
/** * Closes the current query with the character <i>;</i> and returns the output as a string. * * @return the query as string */ @Override public String build() { builder.append(";"); return builder.build(); } }
/** * Appends the string <i>area</i> to the current query. * * @return the current query object */ public OverpassFilterQuery area() { applySeparator(); builder.append("area"); return this; }
/** * Appends the string <i>rel</i> to the current query. * * @return the current query object */ public OverpassFilterQuery rel() { applySeparator(); builder.append("rel"); return this; }
/** * Appends the string <i>node</i> to the current query. * * @return the current query object */ public OverpassFilterQuery node() { applySeparator(); builder.append("node"); return this; }
/** * Closes the current query with the characters <i>;<;)</i> and returns the output as a string. * * @return the query as string */ @Override public String build() { builder.append(";<;)"); return builder.build(); }
public void onSubQueryResult(AbstractOverpassSubQuery subQuery) { builder.append(subQuery.build()); }
@Test public void testRel() throws Exception { filterQuery.rel(); verify(builder).append("rel"); verifyNoMoreInteractions(builder); }
@Test public void testArea() throws Exception { filterQuery.area(); verify(builder).append("area"); verifyNoMoreInteractions(builder); }
@Test public void testNode() throws Exception { filterQuery.node(); verify(builder).append("node"); verifyNoMoreInteractions(builder); }
@Test public void testWay() throws Exception { filterQuery.way(); verify(builder).append("way"); verifyNoMoreInteractions(builder); }
@Test public void testOutputWithCustomArgs() throws Exception { query.output(OutputVerbosity.META, OutputModificator.GEOM, OutputOrder.ASC, 100); verify(builder).append("; out meta geom asc 100"); } }
@Test public void testBuild() throws Exception { query.build(); verify(builder).append(";"); }
@Test public void testBoundingBox() throws Exception { query.boundingBox(1.00000001, 2.00000002, 3.00000003, 4.00000004); verify(builder).append("[bbox:1.00000001,2.00000002,3.00000003,4.00000004]"); }
@Test public void testOutputWithDefaultArgs() throws Exception { query.output(100); verify(builder).append("; out body center qt 100"); }
@Before public void setUp() throws Exception { filterQuery = new OverpassFilterQuery(query, builder); verify(builder).append(START_TOKEN); }
@Test public void testBuild() throws Exception { filterQuery.build(); verify(builder).append(END_TOKEN); verify(builder).build(); verifyNoMoreInteractions(builder); }
@Test public void testAppend() throws Exception { queryBuilder.append("foo"); assertEquals("foo", queryBuilder.build()); }