NotificationChannelRegistryDataManager extends DataManager { @NonNull @WorkerThread public Set<NotificationChannelCompat> getChannels() { Cursor cursor = query(TABLE_NAME, null, null, null, null); Set<NotificationChannelCompat> channels = new HashSet<>(); if (cursor == null) { return channels; } cursor.moveToFirst(); while (!cursor.isAfterLast()) { NotificationChannelCompat channelCompat = getChannel(cursor); channels.add(channelCompat); cursor.moveToNext(); } return channels; } NotificationChannelRegistryDataManager(@NonNull Context context, @NonNull String appKey, @NonNull String dbName); @WorkerThread boolean createChannel(@NonNull NotificationChannelCompat channelCompat); @NonNull @WorkerThread Set<NotificationChannelCompat> getChannels(); @Nullable @WorkerThread NotificationChannelCompat getChannel(@NonNull String channelId); @WorkerThread boolean deleteChannel(@NonNull String channelId);  }
@Test public void testGetChannels() { dataManager.createChannel(channel1); dataManager.createChannel(channel2); Set<NotificationChannelCompat> channels = new HashSet<>(); channels.add(channel1); channels.add(channel2); Set<NotificationChannelCompat> otherChannels = dataManager.getChannels(); Assert.assertEquals(channels, otherChannels); }