Search in sources :

Example 6 with PreferencesAdapter

use of com.codeslap.persistence.PreferencesAdapter in project persistence by casidiablo.

the class PrefRetrieveTest method shouldReturnNullWhenRetrievingImpossibleBean.

@Test
public void shouldReturnNullWhenRetrievingImpossibleBean() {
    PreferencesAdapter adapter = Persistence.getPreferenceAdapter(new Activity());
    PrefImpossibleBean retrieve = adapter.retrieve(PrefImpossibleBean.class);
    assertNull(retrieve);
}
Also used : Activity(android.app.Activity) PreferencesAdapter(com.codeslap.persistence.PreferencesAdapter) Test(org.junit.Test)

Example 7 with PreferencesAdapter

use of com.codeslap.persistence.PreferencesAdapter in project persistence by casidiablo.

the class PrefRetrieveTest method shouldReturnFullObjectWhenUsingAnnotations.

@Test
public void shouldReturnFullObjectWhenUsingAnnotations() {
    PreferencesAdapter adapter = Persistence.getPreferenceAdapter(new Activity());
    PrefWithAnnotations retrieve = adapter.retrieve(PrefWithAnnotations.class);
    assertEquals(Integer.MIN_VALUE, retrieve.number);
    assertEquals(Float.MIN_VALUE, retrieve.decimal, 0);
    assertEquals(Long.MIN_VALUE, retrieve.veryLong, 0);
    assertEquals("foo bar", retrieve.name);
    assertTrue(retrieve.bool);
}
Also used : Activity(android.app.Activity) PreferencesAdapter(com.codeslap.persistence.PreferencesAdapter) Test(org.junit.Test)

Aggregations

Activity (android.app.Activity)7 PreferencesAdapter (com.codeslap.persistence.PreferencesAdapter)7 Test (org.junit.Test)7