MessageCenterResolver extends UrbanAirshipResolver { @NonNull List<Message> getMessages() { List<Message> messages = new ArrayList<>(); Cursor cursor = this.query(this.uri, null, null, null, null); if (cursor == null) { return messages; } while (cursor.moveToNext()) { try { String messageJson = cursor.getString(cursor.getColumnIndex(MessageCenterDataManager.MessageTable.COLUMN_NAME_RAW_MESSAGE_OBJECT)); boolean unreadClient = cursor.getInt(cursor.getColumnIndex(MessageCenterDataManager.MessageTable.COLUMN_NAME_UNREAD)) == 1; boolean deleted = cursor.getInt(cursor.getColumnIndex(MessageCenterDataManager.MessageTable.COLUMN_NAME_DELETED)) == 1; Message message = Message.create(JsonValue.parseString(messageJson), unreadClient, deleted); if (message != null) { messages.add(message); } } catch (JsonException e) { Logger.error(e, "RichPushResolver - Failed to parse message from the database."); } } cursor.close(); return messages; } MessageCenterResolver(Context context);   }
@Test public void testGetMessages() { assertEquals(10, resolver.getMessages().size()); }