@Test
public void testEncodeNullAndEmptyParams() throws Exception {

  RequestParamsExtractor<Integer> extractor =
      getMockExtractor(1, Collections.<String, String>emptyMap());
  RequestUrlParamsEncoder<Integer> encoder = new RequestUrlParamsEncoder<>(extractor, false);
  String encodedParams = encoder.encode(1);
  assertEquals("", encodedParams);
  extractor = getMockExtractor(1, null);
  encoder = new RequestUrlParamsEncoder<>(extractor, false);
  NullPointerException exception = null;
  try {
    encoder.encode(1);
  } catch (NullPointerException e) {
    exception = e;
  }
  assertNotNull(exception);
}