### Question:
KeyValueQueryBuilder implements QueryOperationBuilder { public <K, V> Query<K, V> range() { return new Query<>(storeName, new GetKeyValueRangeQueryBuilder<>()); } KeyValueQueryBuilder(final String storeName); @Override Query operation(final StoreOperation operation); Query<K, V> all(); Query<K, V> get(); Query<K, V> range(); Query<String, Long> count(); static final String QUERY_PARAM_KEY; static final String QUERY_PARAM_KEY_FROM; static final String QUERY_PARAM_KEY_TO; }### Answer:
@Test public void shouldThrowInvalidQueryWhenBuildingKeyValueRangeGivenNoKeyParam() { final Query query = new KeyValueQueryBuilder(STORE_NAME).range(); InvalidQueryException exception = assertThrows(InvalidQueryException.class, query::prepare); assertEquals( exception.getMessage(), "Missing requires parameters : [" + KeyValueQueryBuilder.QUERY_PARAM_KEY_FROM+ ", " + KeyValueQueryBuilder.QUERY_PARAM_KEY_TO + "]"); }
@Test public void shouldSuccessWhenBuildingKeyValueRangeGivenKeyParam() { final Query<Object, Object> query = new KeyValueQueryBuilder(STORE_NAME).range(); PreparedQuery<Object, Object> prepared = query.prepare(new QueryParams(new HashMap<>() {{ put(KeyValueQueryBuilder.QUERY_PARAM_KEY_FROM, "keyFrom"); put(KeyValueQueryBuilder.QUERY_PARAM_KEY_TO, "keyTo"); }})); assertNotNull(prepared); }