Ejemplo n.º 1
0
 public void testInfiniteAdapterWhichIsEmpty() {
   final Context context = getContext();
   final Resources res = context.getResources();
   final String[] uris = new String[] {};
   when(mSimpleAdapter.getSize()).thenReturn(0);
   when(mSimpleAdapter.isLazy()).thenReturn(true);
   final SimpleAdapter infinite = SimpleAdapter.Util.makeItInfinite(mSimpleAdapter);
   assertEquals(0, infinite.getSize());
   assertTrue(infinite.isLazy());
 }
Ejemplo n.º 2
0
 public void testInfiniteAdapter() {
   final Context context = getContext();
   final Resources res = context.getResources();
   final String[] uris = res.getStringArray(R.array.local_uri_test);
   when(mSimpleAdapter.getSize()).thenReturn(10);
   when(mSimpleAdapter.isLazy()).thenReturn(true);
   when(mSimpleAdapter.get(0)).thenReturn(mUri);
   final SimpleAdapter infinite = SimpleAdapter.Util.makeItInfinite(mSimpleAdapter);
   assertEquals(Integer.MAX_VALUE, infinite.getSize());
   assertTrue(infinite.isLazy());
   assertSame(mUri, infinite.get(0));
   assertSame(mUri, infinite.get(10));
 }