### Question:
Utils { static Field[] getAllDeclaredFields(Class<?> clazz, Class<?> stopAt) { Field[] result = new Field[] {}; while (!clazz.equals(stopAt)) { result = concatArrays(result, clazz.getDeclaredFields()); clazz = clazz.getSuperclass(); } return result; }    }### Answer:
@Test public void getAllDeclaredFields() { Field[] fields = Utils.getAllDeclaredFields(TestModel.class, Model.class); System.out.println(fields[0].getName()); assertEquals(fields.length, 2); assertEquals(fields[0].getName(), "title"); assertEquals(fields[1].getName(), "id"); }