### Question:
Cursors { public static void closeQuietly(Cursor cursor) { if (cursor != null && !cursor.isClosed()) { cursor.close(); } } private  Cursors(); static FluentIterable<T> toFluentIterable(Cursor cursor, Function<? super Cursor, T> singleRowTransform); static void closeQuietly(Cursor cursor); static Cursor returnSameOrEmptyIfNull(Cursor cursor);  }### Answer:
@Test public void shouldCloseCursorProperly() throws Exception { final MatrixCursor cursor = new MatrixCursor(new String[] { "column1" }); Cursors.closeQuietly(cursor); assertThat(cursor.isClosed()).isTrue(); }
@Test public void shouldSurviveNullPassedToCloseQuietly() throws Exception { Cursors.closeQuietly(null); }
@Test public void shouldNotTryToCloseAlreadyClosedCursor() throws Exception { Cursor cursor = mock(Cursor.class); when(cursor.isClosed()).thenReturn(true); Cursors.closeQuietly(cursor); verify(cursor, never()).close(); }