### Question:
ParallelQueryBuilder implements Serializable { protected static List<String> queriesForBounds( long min, long max, int parallelism, String splitColumn, QueryBuilder queryBuilder) { List<QueryRange> ranges = generateRanges(min, max, parallelism); return ranges.stream() .map( x -> queryBuilder .withParallelizationCondition( splitColumn, x.getStartPointIncl(), x.getEndPoint(), x.isEndPointExcl()) .build() ) .collect(Collectors.toList()); }    }### Answer:
@Test public void shouldBuildParallelQueriesGivenRangeAndParallelism3() { final List<String> actual = ParallelQueryBuilder.queriesForBounds(100, 400, 3, "sp", QUERY_FORMAT); assertThat( actual, Matchers.is( Lists.newArrayList( format("%s AND sp >= %s AND sp < %s", QUERY_BASE, 100, 200), format("%s AND sp >= %s AND sp < %s", QUERY_BASE, 200, 300), format("%s AND sp >= %s AND sp <= %s", QUERY_BASE, 300, 400)))); }
@Test public void shouldBuildParallelQueriesGivenRangeThatDoesNotDivideEqually() { final List<String> actual = ParallelQueryBuilder.queriesForBounds(100, 402, 5, "sp", QUERY_FORMAT); assertThat( actual, Matchers.is( Lists.newArrayList( format("%s AND sp >= %s AND sp < %s", QUERY_BASE, 100, 161), format("%s AND sp >= %s AND sp < %s", QUERY_BASE, 161, 222), format("%s AND sp >= %s AND sp < %s", QUERY_BASE, 222, 283), format("%s AND sp >= %s AND sp < %s", QUERY_BASE, 283, 344), format("%s AND sp >= %s AND sp <= %s", QUERY_BASE, 344, 402)))); }
@Test public void shouldBuildSingleQueryWhenParallelismIsMoreThanMaxMin() { final List<String> actual = ParallelQueryBuilder.queriesForBounds(1, 2, 5, "sp", QUERY_FORMAT); assertThat( actual, Matchers.is(Lists.newArrayList(format("%s AND sp >= %s AND sp <= %s", QUERY_BASE, 1, 2)))); }
@Test public void shouldBuildSingleQueryWhenMaxMinIsTheSame() { final List<String> actual = ParallelQueryBuilder.queriesForBounds(1, 1, 5, "sp", QUERY_FORMAT); assertThat( actual, Matchers.is(Lists.newArrayList(format("%s AND sp >= %s AND sp <= %s", QUERY_BASE, 1, 1)))); }
@Test public void shouldBuildSingleQueryWhenParallelismIsOne() { final List<String> actual = ParallelQueryBuilder.queriesForBounds(1, 10, 1, "sp", QUERY_FORMAT); assertThat( actual, Matchers.is(Lists.newArrayList(format("%s AND sp >= %s AND sp <= %s", QUERY_BASE, 1, 10)))); }
@Ignore @Test public void shouldBuildMultipleQueriesWhenQueryingFromTwoRows() { final List<String> actual = ParallelQueryBuilder.queriesForBounds(1, 2, 2, "sp", QUERY_FORMAT); assertThat( actual, Matchers.is( Lists.newArrayList( format("%s AND sp >= %s AND sp < %s", QUERY_BASE, 1, 2), format("%s AND sp >= %s AND sp <= %s", QUERY_BASE, 2, 2)))); }