@Test
 public void getCount() {
   cursor.setResults(
       new Object[][] {
         new Object[] {"aString", 1234L, 41}, new Object[] {"anotherString", 5678L, 42}
       });
   assertThat(cursor.getCount()).isEqualTo(2);
 }
 @Test
 public void moveToPositionBoundsChecks() {
   cursor.setResults(
       new Object[][] {
         new Object[] {"aString", 1234L, 41}, new Object[] {"anotherString", 5678L, 42}
       });
   assertThat(cursor.moveToPosition(2)).isFalse();
   assertThat(cursor.moveToPosition(-1)).isFalse();
 }
 @Test
 public void getColumnIndex() {
   assertThat(cursor.getColumnIndex("invalidColumn")).isEqualTo(-1);
   assertThat(cursor.getColumnIndex("stringColumn")).isEqualTo(0);
   assertThat(cursor.getColumnIndexOrThrow("stringColumn")).isEqualTo(0);
   try {
     cursor.getColumnIndexOrThrow("invalidColumn");
     fail();
   } catch (IllegalArgumentException ex) {
   }
 }
 @Before
 public void setup() throws Exception {
   contentResolver = RuntimeEnvironment.application.getContentResolver();
   ShadowContentResolver shadowContentResolver = shadowOf(contentResolver);
   uri = Uri.parse("http://foo");
   cursor = new RoboCursor();
   shadowContentResolver.setCursor(uri, cursor);
   ArrayList<String> columnNames = new ArrayList<>();
   columnNames.add("stringColumn");
   columnNames.add("longColumn");
   columnNames.add("intColumn");
   cursor.setColumnNames(columnNames);
 }
  @Test
  public void moveToPositionMovesToAppropriateRow() throws Exception {
    cursor.setResults(
        new Object[][] {
          new Object[] {"aString", 1234L, 41}, new Object[] {"anotherString", 5678L, 42}
        });
    assertThat(cursor.moveToPosition(1)).isTrue();
    assertThat(cursor.getString(cursor.getColumnIndex("stringColumn"))).isEqualTo("anotherString");
    assertThat(cursor.getLong(cursor.getColumnIndex("longColumn"))).isEqualTo(5678L);
    assertThat(cursor.getInt(cursor.getColumnIndex("intColumn"))).isEqualTo(42);

    assertThat(cursor.moveToPosition(0)).isTrue();
    assertThat(cursor.getString(cursor.getColumnIndex("stringColumn"))).isEqualTo("aString");
    assertThat(cursor.getLong(cursor.getColumnIndex("longColumn"))).isEqualTo(1234L);
    assertThat(cursor.getInt(cursor.getColumnIndex("intColumn"))).isEqualTo(41);
  }
 @Test
 public void moveToNextAdvancesToNextRow() throws Exception {
   cursor.setResults(
       new Object[][] {
         new Object[] {"aString", 1234L, 41}, new Object[] {"anotherString", 5678L, 42}
       });
   assertThat(cursor.getCount()).isEqualTo(2);
   assertThat(cursor.getColumnCount()).isEqualTo(3);
   assertThat(cursor.getType(0)).isEqualTo(Cursor.FIELD_TYPE_STRING);
   assertThat(cursor.getType(1)).isEqualTo(Cursor.FIELD_TYPE_INTEGER);
   assertThat(cursor.moveToNext()).isTrue();
   assertThat(cursor.moveToNext()).isTrue();
   assertThat(cursor.getColumnName(0)).isEqualTo("stringColumn");
   assertThat(cursor.getColumnName(1)).isEqualTo("longColumn");
   assertThat(cursor.getString(cursor.getColumnIndex("stringColumn"))).isEqualTo("anotherString");
   assertThat(cursor.getLong(cursor.getColumnIndex("longColumn"))).isEqualTo(5678L);
   assertThat(cursor.getInt(cursor.getColumnIndex("intColumn"))).isEqualTo(42);
 }
 @Test
 public void closeIsRemembered() throws Exception {
   cursor.close();
   assertThat(cursor.getCloseWasCalled()).isTrue();
 }