@Test public void testBuildStatement() { assertThat(storeService.buildStatement(query1)).isEqualTo(statement1); assertThat(storeService.buildStatement(query2)).isEqualTo(statement2); }
Statement buildStatement(LocationBounds bounds) { return Statement .newBuilder("SELECT * FROM " + TABLE_NAME + " WHERE latitude BETWEEN @lat1 AND @lat2 AND longitude BETWEEN @lng1 AND @lng2") .bind("lat1").to(bounds.getLat1()) .bind("lat2").to(bounds.getLat2()) .bind("lng1").to(bounds.getLng1()) .bind("lng2").to(bounds.getLng2()) .build(); }
StoreService { Statement buildStatement(LocationBounds bounds) { return Statement .newBuilder("SELECT * FROM " + TABLE_NAME + " WHERE latitude BETWEEN @lat1 AND @lat2 AND longitude BETWEEN @lng1 AND @lng2") .bind("lat1").to(bounds.getLat1()) .bind("lat2").to(bounds.getLat2()) .bind("lng1").to(bounds.getLng1()) .bind("lng2").to(bounds.getLng2()) .build(); } }
StoreService { Statement buildStatement(LocationBounds bounds) { return Statement .newBuilder("SELECT * FROM " + TABLE_NAME + " WHERE latitude BETWEEN @lat1 AND @lat2 AND longitude BETWEEN @lng1 AND @lng2") .bind("lat1").to(bounds.getLat1()) .bind("lat2").to(bounds.getLat2()) .bind("lng1").to(bounds.getLng1()) .bind("lng2").to(bounds.getLng2()) .build(); } StoreService(StoreRepository storeRepository); }
StoreService { Statement buildStatement(LocationBounds bounds) { return Statement .newBuilder("SELECT * FROM " + TABLE_NAME + " WHERE latitude BETWEEN @lat1 AND @lat2 AND longitude BETWEEN @lng1 AND @lng2") .bind("lat1").to(bounds.getLat1()) .bind("lat2").to(bounds.getLat2()) .bind("lng1").to(bounds.getLng1()) .bind("lng2").to(bounds.getLng2()) .build(); } StoreService(StoreRepository storeRepository); List<Store> findWithinBounds(LocationBounds bounds); }
StoreService { Statement buildStatement(LocationBounds bounds) { return Statement .newBuilder("SELECT * FROM " + TABLE_NAME + " WHERE latitude BETWEEN @lat1 AND @lat2 AND longitude BETWEEN @lng1 AND @lng2") .bind("lat1").to(bounds.getLat1()) .bind("lat2").to(bounds.getLat2()) .bind("lng1").to(bounds.getLng1()) .bind("lng2").to(bounds.getLng2()) .build(); } StoreService(StoreRepository storeRepository); List<Store> findWithinBounds(LocationBounds bounds);  }