コード例 #1
0
  @Test
  public void testSetters() {
    Uri uri = Uri.parse("http://robolectric.org");
    String[] projection = new String[] {"_id", "TestColumn"};
    String selection = "_id = ?";
    String[] selectionArgs = new String[] {"5"};
    String sortOrder = "_id";
    CursorLoader cursorLoader = new CursorLoader(RuntimeEnvironment.application);
    cursorLoader.setUri(uri);
    cursorLoader.setProjection(projection);
    cursorLoader.setSelection(selection);
    cursorLoader.setSelectionArgs(selectionArgs);
    cursorLoader.setSortOrder(sortOrder);

    assertThat(cursorLoader.getUri()).isEqualTo(uri);
    assertThat(cursorLoader.getProjection()).isEqualTo(projection);
    assertThat(cursorLoader.getSelection()).isEqualTo(selection);
    assertThat(cursorLoader.getSelectionArgs()).isEqualTo(selectionArgs);
    assertThat(cursorLoader.getSortOrder()).isEqualTo(sortOrder);
  }