@Test public void shouldNotMatchWhenQueryStringIsNull() { QueryParameterMatcher queryParameterMatcher = new QueryParameterMatcher("KEY", "VALUE"); boolean matches = queryParameterMatcher.match(null); assertFalse(matches); }
public boolean match(String queryString) { if (StringUtils.isEmpty(queryString)) { return false; } String[] queryParams = queryString.split("&"); for (String param : queryParams) { String[] params = param.split("="); if (params.length != 2) { throw new IllegalArgumentException("Query Param string does not contain valid query parameters"); } String key = params[0]; String val = params[1]; if (queryParam.equalsIgnoreCase(key) && value.equalsIgnoreCase(val)) { return true; } } return false; }
QueryParameterMatcher { public boolean match(String queryString) { if (StringUtils.isEmpty(queryString)) { return false; } String[] queryParams = queryString.split("&"); for (String param : queryParams) { String[] params = param.split("="); if (params.length != 2) { throw new IllegalArgumentException("Query Param string does not contain valid query parameters"); } String key = params[0]; String val = params[1]; if (queryParam.equalsIgnoreCase(key) && value.equalsIgnoreCase(val)) { return true; } } return false; } }
QueryParameterMatcher { public boolean match(String queryString) { if (StringUtils.isEmpty(queryString)) { return false; } String[] queryParams = queryString.split("&"); for (String param : queryParams) { String[] params = param.split("="); if (params.length != 2) { throw new IllegalArgumentException("Query Param string does not contain valid query parameters"); } String key = params[0]; String val = params[1]; if (queryParam.equalsIgnoreCase(key) && value.equalsIgnoreCase(val)) { return true; } } return false; } QueryParameterMatcher(String queryParam, String value); }
QueryParameterMatcher { public boolean match(String queryString) { if (StringUtils.isEmpty(queryString)) { return false; } String[] queryParams = queryString.split("&"); for (String param : queryParams) { String[] params = param.split("="); if (params.length != 2) { throw new IllegalArgumentException("Query Param string does not contain valid query parameters"); } String key = params[0]; String val = params[1]; if (queryParam.equalsIgnoreCase(key) && value.equalsIgnoreCase(val)) { return true; } } return false; } QueryParameterMatcher(String queryParam, String value); boolean match(String queryString); }
QueryParameterMatcher { public boolean match(String queryString) { if (StringUtils.isEmpty(queryString)) { return false; } String[] queryParams = queryString.split("&"); for (String param : queryParams) { String[] params = param.split("="); if (params.length != 2) { throw new IllegalArgumentException("Query Param string does not contain valid query parameters"); } String key = params[0]; String val = params[1]; if (queryParam.equalsIgnoreCase(key) && value.equalsIgnoreCase(val)) { return true; } } return false; } QueryParameterMatcher(String queryParam, String value); boolean match(String queryString);  }