Example #1
0
 @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);
 }
Example #2
0
 @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);
 }
Example #3
0
 @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);
 }
Example #4
0
 @Test(expected = NoTypeSerializerFoundException.class)
 public void getNonExistingTypeSerializer() {
   Sprinkles s = Sprinkles.init(Robolectric.application);
   s.getTypeSerializer(MyObject.class);
 }