@Test
  public void getGetOptionTest() throws Exception {
    for (GetOption option : GetOption.values()) {
      JSONObject headers = new JSONObject();
      headers.put(RestUtils.Headers.GET_OPTION, option.toString().toLowerCase());
      RestRequest restRequest = createRestRequest(RestMethod.GET, "/", headers);
      assertEquals("Option returned not as expected", option, RestUtils.getGetOption(restRequest, null));
      assertEquals("Option returned not as expected", option, RestUtils.getGetOption(restRequest, option));
      assertEquals("Option returned not as expected", option, RestUtils.getGetOption(restRequest, GetOption.None));
    }
    // no value defined
    RestRequest restRequest = createRestRequest(RestMethod.GET, "/", null);
    assertEquals("Option returned not as expected", GetOption.None, RestUtils.getGetOption(restRequest, null));
    for (GetOption option : GetOption.values()) {
      assertEquals("Option returned not as expected", option, RestUtils.getGetOption(restRequest, option));
    }
    // bad value
    JSONObject headers = new JSONObject();
    headers.put(RestUtils.Headers.GET_OPTION, "non_existent_option");
    restRequest = createRestRequest(RestMethod.GET, "/", headers);
    try {
      RestUtils.getGetOption(restRequest, GetOption.None);
      fail("Should have failed to get GetOption because value of header is invalid");
    } catch (RestServiceException e) {
      assertEquals("Unexpected RestServiceErrorCode", RestServiceErrorCode.InvalidArgs, e.getErrorCode());
    }
  }
Tests {@link RestUtils#getGetOption(RestRequest, GetOption)}.
@throws Exception
ambry-api/src/test/java/com/github/ambry/rest/RestUtilsTest.java