@Test public void registerType() { Sprinkles s = Sprinkles.init(Robolectric.application); TypeSerializer serializer = new MyObjectSerializer(); s.registerType(MyObject.class, serializer); assertEquals(s.getTypeSerializer(MyObject.class), serializer); }
@Test public void init() { assertNull(Sprinkles.sInstance); Sprinkles s1 = Sprinkles.init(Robolectric.application); assertNotNull(Sprinkles.sInstance); Sprinkles s2 = Sprinkles.init(Robolectric.application); assertEquals(s1, s2); }
@Test public void addMigration() { Sprinkles s = Sprinkles.init(Robolectric.application); assertEquals(s.mMigrations.size(), 0); Migration m = new Migration() { @Override protected void doMigration(SQLiteDatabase db) {} }; s.addMigration(m); assertEquals(s.mMigrations.get(0), m); }
@Test(expected = NoTypeSerializerFoundException.class) public void getNonExistingTypeSerializer() { Sprinkles s = Sprinkles.init(Robolectric.application); s.getTypeSerializer(MyObject.class); }
@Before public void reset() { Sprinkles.dropInstances(); }