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 testGetLayoutInflater() throws Exception {
   assertThat(adapter.getLayoutInflater(), is(instanceOf(LayoutInflater.class)));
 }
Ejemplo n.º 3
0
 @Test
 public void testGetContext() throws Exception {
   assertThat(adapter.getContext(), is(instanceOf(Context.class)));
 }
Ejemplo n.º 4
0
 @Test
 public void testClearAsObservable() throws Exception {
   int deletedCount = adapter.clearAsObservable().toBlocking().value();
   assertThat(deletedCount, is(3));
   assertThat(adapter.getItemCount(), is(0));
 }
Ejemplo n.º 5
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.º 6
0
 @Test
 public void testGetItemAsObservable() throws Exception {
   assertThat(adapter.getItemAsObservable(0).toBlocking().value().name, is("A"));
   assertThat(adapter.getItemAsObservable(1).toBlocking().value().name, is("B"));
   assertThat(adapter.getItemAsObservable(2).toBlocking().value().name, is("C"));
 }
Ejemplo n.º 7
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"));
 }
Ejemplo n.º 8
0
 @Test
 public void testGetRelation() throws Exception {
   assertThat(adapter.getRelation(), is(instanceOf(Relation.class)));
 }
Ejemplo n.º 9
0
 @Test
 public void testGetItemCount() throws Exception {
   assertThat(adapter.getItemCount(), is(3));
 }