@Test
  public void encodeKVHeaderValueTest() {
    // test for empty map
    Map<String, String> headerValue = new HashMap<>();
    assertEquals("Invalid encoded value", "", RestUtils.KVHeaderValueEncoderDecoder.encodeKVHeaderValue(headerValue));

    // test for null map
    try {
      RestUtils.KVHeaderValueEncoderDecoder.encodeKVHeaderValue(null);
      fail("Null value should throw error");
    } catch (NullPointerException npEx) {
    }

    // test for valid map
    headerValue.put(QuotaName.READ_CAPACITY_UNIT.name(), String.valueOf(1.9));
    headerValue.put(QuotaName.STORAGE_IN_GB.name(), String.valueOf(3.0));
    assertEquals("Invalid encoded value", "READ_CAPACITY_UNIT=1.9; STORAGE_IN_GB=3.0",
        RestUtils.KVHeaderValueEncoderDecoder.encodeKVHeaderValue(headerValue));

    // test for single value in map
    headerValue.remove(QuotaName.STORAGE_IN_GB.name());
    assertEquals("Invalid encoded value", "READ_CAPACITY_UNIT=1.9",
        RestUtils.KVHeaderValueEncoderDecoder.encodeKVHeaderValue(headerValue));
  }
Tests for {@link RestUtils.KVHeaderValueEncoderDecoder#encodeKVHeaderValue(Map)}.
ambry-api/src/test/java/com/github/ambry/rest/RestUtilsTest.java