### Question:
SearchModel { @JsonIgnore public void addFilter(String field, String operator, String value) { if (this.filter == null || this.filter.length == 0) { this.filter = new String[][]{new String[]{field, operator, value}}; } else { this.filter = Arrays.copyOf(this.filter, this.filter.length + 1); this.filter[filter.length - 1] = new String[]{field, operator, value}; } } SearchModel(); String getQ(); void setQ(String q); Integer getOffset(); void setOffset(Integer offset); Integer getLimit(); void setLimit(Integer limit); String[] getFields(); void setFields(String[] fields); String[] getSort(); void setSort(String[] sort); String[][] getFilter(); void setFilter(String[][] filter); void setFilterExpression(String filter); long getTotalCount(); void setTotalCount(long totalCount); HttpServletResponse getResponse(); void setResponse(HttpServletResponse response); @JsonIgnore void addFilter(String field, String operator, String value); @JsonIgnore void addSort(String field, String operator); @Override boolean equals(Object o); @Override int hashCode();  }### Answer:
@Test public void addFilter() throws Exception { SearchModel model = new SearchModel(); model.addFilter("field1", "=", "val"); assertArrayEquals(new String[][]{new String[]{"field1", "=", "val"}}, model.getFilter()); model.addFilter("field2", "<", "5"); assertArrayEquals(new String[][]{new String[]{"field1", "=", "val"}, new String[]{"field2", "<", "5"}}, model.getFilter()); }