Ejemplo n.º 1
0
 @Test
 public void testAddItemAsObservable() throws Exception {
   long id =
       adapter
           .addItemAsObservable(
               new ModelFactory<Author>() {
                 @NonNull
                 @Override
                 public Author call() {
                   Author author = new Author();
                   author.name = "D";
                   author.note = "new";
                   return author;
                 }
               })
           .toBlocking()
           .value();
   assertThat(id, is(not(-1L)));
   assertThat(adapter.getItem(3).name, is("D"));
 }
Ejemplo n.º 2
0
 @Test
 public void testRemoveItemAsObservable() throws Exception {
   int deletedPosition = adapter.removeItemAsObservable(adapter.getItem(0)).toBlocking().single();
   assertThat(deletedPosition, is(0));
   assertThat(adapter.getItemCount(), is(2));
 }
Ejemplo n.º 3
0
 @Test
 public void testGetItem() throws Exception {
   assertThat(adapter.getItem(0).name, is("A"));
   assertThat(adapter.getItem(1).name, is("B"));
   assertThat(adapter.getItem(2).name, is("C"));
 }