@Test public void combinerShouldCombineKeys() { initPrefs("red", true, "blue", false); PrefMigrator.migrate(prefs, COMBINER); assertPrefs("mix", "red"); initPrefs("red", false, "blue", true); PrefMigrator.migrate(prefs, COMBINER); assertPrefs("mix", "blue"); initPrefs("red", true, "blue", true); PrefMigrator.migrate(prefs, COMBINER); assertPrefs("mix", "purple"); initPrefs("red", false); PrefMigrator.migrate(prefs, COMBINER); assertPrefs("red", false); initPrefs("red", false, "blue", false); PrefMigrator.migrate(prefs, COMBINER); assertPrefs("red", false, "blue", false); initPrefs("red", true); PrefMigrator.migrate(prefs, COMBINER); assertPrefs("mix", "red"); initPrefs("blue", true); PrefMigrator.migrate(prefs, COMBINER); assertPrefs("mix", "blue"); }
public static void migrate(SharedPreferences prefs, Migration... migrations) { for (Migration migration : migrations) { migration.apply(prefs); } }
PrefMigrator { public static void migrate(SharedPreferences prefs, Migration... migrations) { for (Migration migration : migrations) { migration.apply(prefs); } } }
PrefMigrator { public static void migrate(SharedPreferences prefs, Migration... migrations) { for (Migration migration : migrations) { migration.apply(prefs); } } private  PrefMigrator(); }
PrefMigrator { public static void migrate(SharedPreferences prefs, Migration... migrations) { for (Migration migration : migrations) { migration.apply(prefs); } } private  PrefMigrator(); static void migrate(SharedPreferences prefs, Migration... migrations); static void migrateSharedPrefs(); }
PrefMigrator { public static void migrate(SharedPreferences prefs, Migration... migrations) { for (Migration migration : migrations) { migration.apply(prefs); } } private  PrefMigrator(); static void migrate(SharedPreferences prefs, Migration... migrations); static void migrateSharedPrefs();  }