### Question:
Model extends BaseObject { public static <T extends Model> List<T> where(Object... paramValues) { throw new UnsupportedOperationException(NIE); } Model(); void updateAttributes(Map<String, Object> attributes); abstract Serializable getId(); static T findById(Serializable id); static long count(); static long count(Filter filter); static List<T> all(); static void deleteAll(); static void deleteAll(Filter filter); static boolean exists(Serializable id); static Filter filter(); static List<T> where(Object... paramValues); static List<T> where(Filter filter); static T one(Object... paramValues); static T first(Object... paramValues); static EntityTransaction beginTxn(); void persist(); void delete(); void merge(); void refresh(); EntityCollection<T> collection(String name);  }### Answer:
@Test public void shouldSearchByKeyValue() { DummyModel model = createModel("test123", "test"); createModel("test1234", "test"); assertEquals(DummyModel.where(new Object[]{"column1", "test123"}), Arrays.asList(model)); }
@Test public void shouldSearchByMultipleKeyValues() { DummyModel model = createModel("test123", "test125"); createModel("test1234", "test125"); assertEquals(DummyModel.where(new Object[]{"column1", "test123", "column2", "test125"}), Arrays.asList(model)); }
@Test public void shouldSearchUsingFilter() { DummyModel model = createModel("test123", "test125"); createModel("test1234", "test125"); assertEquals(DummyModel.where(new Filter(new Condition("column1", "test123"), new Condition("column2", "test125"))), Arrays.asList(model)); }
@Test public void shouldOrderByFieldAsc() { DummyModel model = createModel("column1", "column2"); DummyModel model1 = createModel("column1", "column2"); Filter filter = new Filter(); filter.sortBy("id", true); List<DummyModel> models = DummyModel.where(filter); assertEquals(models.get(0), model); assertEquals(models.get(1), model1); }
@Test public void shouldOrderByFieldDesc() { DummyModel model = createModel("column1", "column2"); DummyModel model1 = createModel("column1", "column2"); Filter filter = new Filter(); filter.sortBy("id", false); List<DummyModel> models = DummyModel.where(filter); assertEquals(models.get(1), model); assertEquals(models.get(0), model1); }
@Test public void shouldOrderByMultipleFields() { DummyModel model = createModel("column1", "column2"); DummyModel model1 = createModel("column1", "column2"); Filter filter = new Filter(); filter.sortBy("column1", false); filter.sortBy("id", false); List<DummyModel> models = DummyModel.where(filter); assertEquals(models.get(0), model1); assertEquals(models.get(1), model); }
@Test public void shouldFilterByIsNull() { DummyModel model = createModel("column1", "column2"); DummyModel model1 = createModel("column1", null); Filter filter = new Filter(new Condition("column2", Operator.is_null)); List<DummyModel> models = DummyModel.where(filter); assertEquals(models.size(), 1); assertEquals(models.get(0), model1); }
@Test public void shouldFilterByIsNotNull() { DummyModel model = createModel("column1", "column2"); DummyModel model1 = createModel("column1", null); Filter filter = new Filter(new Condition("column1", Operator.is_not_null)); List<DummyModel> models = DummyModel.where(filter); assertEquals(models.size(), 2); assertEquals(models.get(0), model); assertEquals(models.get(1), model1); }