### Question:
RestUtils { public static GetOption getGetOption(RestRequest restRequest, GetOption defaultGetOption) throws RestServiceException { GetOption option = defaultGetOption == null ? GetOption.None : defaultGetOption; Object value = restRequest.getArgs().get(RestUtils.Headers.GET_OPTION); if (value != null) { String str = (String) value; boolean foundMatch = false; for (GetOption getOption : GetOption.values()) { if (str.equalsIgnoreCase(getOption.name())) { option = getOption; foundMatch = true; break; } } if (!foundMatch) { throw new RestServiceException("Unrecognized value for [" + RestUtils.Headers.GET_OPTION + "]: " + str, RestServiceErrorCode.InvalidArgs); } } return option; }  static BlobProperties buildBlobProperties(Map<String, Object> args); static byte[] buildUserMetadata(Map<String, Object> args); static Map<String, String> buildUserMetadata(byte[] userMetadata); static GetBlobOptions buildGetBlobOptions(Map<String, Object> args, SubResource subResource,
      GetOption getOption, int blobSegmentIdx); static Pair<String, Long> buildContentRangeAndLength(ByteRange range, long blobSize,
      boolean resolveRangeOnEmptyBlob); static RequestPath getRequestPath(RestRequest restRequest); static Long getTimeFromDateString(String dateString); static long toSecondsPrecisionInMs(long ms); static GetOption getGetOption(RestRequest restRequest, GetOption defaultGetOption); static boolean isPrivate(Map<String, Object> args); static boolean isChunkUpload(Map<String, Object> args); static void ensureRequiredHeadersOrThrow(RestRequest restRequest, Set<String> requiredHeaders); static String getHeader(Map<String, ?> args, String header, boolean required); static Long getLongHeader(Map<String, ?> args, String header, boolean required); static T getNumericalHeader(Map<String, ?> args, String header, boolean required,
      Function<String, T> converter); static boolean getBooleanHeader(Map<String, Object> args, String header, boolean required); static Account getAccountFromArgs(Map<String, Object> args); static Container getContainerFromArgs(Map<String, Object> args); static void accountAndContainerNamePreconditionCheck(RestRequest restRequest); static boolean setUserMetadataHeaders(byte[] userMetadata, RestResponseChannel restResponseChannel); static final String HTTP_DATE_FORMAT; static final String BYTE_RANGE_UNITS; static final String SIGNED_ID_PREFIX; static final String JSON_CONTENT_TYPE; }### Answer:
@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)); } 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)); } 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()); } }