/** Tests the usage of complex keys for supported methods. */
  @Test
  public void testComplexKeys() throws UnsupportedEncodingException {
    ComplexKey start = ComplexKey.of(2012, 05, 05);
    ComplexKey end = ComplexKey.of(2012, 05, 12);
    ComplexKey key = ComplexKey.of("mykey");
    ComplexKey keys = ComplexKey.of("users:10", "users:11");

    Query query = new Query();
    query.setRangeStart(start);
    query.setRangeEnd(end);
    assertEquals(2, query.getArgs().size());
    String result = URLDecoder.decode(query.toString(), "UTF-8");
    assertEquals("?startkey=[2012,5,5]&endkey=[2012,5,12]", result);

    query = new Query();
    query.setRange(start, end);
    assertEquals(2, query.getArgs().size());
    result = URLDecoder.decode(query.toString(), "UTF-8");
    assertEquals("?startkey=[2012,5,5]&endkey=[2012,5,12]", result);

    query = new Query();
    query.setKey(key);
    assertEquals(1, query.getArgs().size());
    result = URLDecoder.decode(query.toString(), "UTF-8");
    assertEquals("?key=\"mykey\"", result);

    query = new Query();
    query.setKeys(keys);
    assertEquals(1, query.getArgs().size());
    result = URLDecoder.decode(query.toString(), "UTF-8");
    assertEquals("?keys=[\"users:10\",\"users:11\"]", result);
  }
  @Test
  public void testBooleans() {
    Query query = new Query();
    query.setKey(ComplexKey.of(true));
    query.setKeys(ComplexKey.of(false));

    assertEquals("?keys=false&key=true", query.toString());
  }
  /** Tests the "keys" argument. */
  @Test
  public void testKeys() throws UnsupportedEncodingException {
    Query query = new Query();
    query.setKeys("[2, 3, 4]");

    assertEquals(1, query.getArgs().size());
    String result = URLDecoder.decode(query.toString(), "UTF-8");
    assertEquals("?keys=[2, 3, 4]", result);
  }