GetPendingMigrations { public Observable<List<io.rx_cache2.MigrationCache>> react() { if (migrations == null || migrations.isEmpty()) { return Observable.just((List<io.rx_cache2.MigrationCache>) new ArrayList<io.rx_cache2.MigrationCache>()); } Collections.sort(migrations, new Comparator<io.rx_cache2.MigrationCache>() { @Override public int compare( io.rx_cache2.MigrationCache migration1, io.rx_cache2.MigrationCache migration2) { return migration1.version() - migration2.version(); } }); List<io.rx_cache2.MigrationCache> pendingMigrations = new ArrayList<>(); for (io.rx_cache2.MigrationCache migration : migrations) { if (cacheVersion < migration.version()) { pendingMigrations.add(migration); } } return Observable.just(pendingMigrations); } @Inject  GetPendingMigrations(); Observable<List<io.rx_cache2.MigrationCache>> react();  }
@Test public void When_No_Scheme_Migration_Supplied_Then_Retrieve_Empty() { getPendingMigrationsUT = new io.rx_cache2.internal.migration.GetPendingMigrations(); TestObserver<List<MigrationCache>> testObserver = getPendingMigrationsUT.react().test(); testObserver.awaitTerminalEvent(); List<MigrationCache> migrations = testObserver.values().get(0); assertThat(migrations.size(), is(0)); }