ParamParser { public static Long getId(Map<String, String> requestParams) { try { Long id = null; if (requestParams.containsKey(ID)) { id = Long.valueOf(requestParams.get(ID)); } return id; } catch (NumberFormatException e) { throw new InvalidParameterException("Given ID is not a number!", e); } } private  ParamParser(); static QueryParams buildQueryParams(Map<String, String> requestParams); static String getLookupName(Map<String, String> requestParams); static Long getId(Map<String, String> requestParams); static Boolean getIncludeBlob(Map<String, String> requestParams); static final String PAGE; static final String PAGE_SIZE; static final String SORT_BY; static final String ORDER_DIR; static final String LOOKUP_NAME; static final String ID; static final String INCLUDE_BLOB; }
@Test public void shouldGetIds() { Map<String, String> requestParams = new HashMap<>(); assertNull(ParamParser.getId(requestParams)); requestParams.put("id", "14"); assertEquals(Long.valueOf(14), ParamParser.getId(requestParams)); }