Database { public static String getString(Cursor cursor, String columnName) { return cursor.getString(cursor.getColumnIndexOrThrow(columnName)); } private  Database(); static String getString(Cursor cursor, String columnName); static int getInt(Cursor cursor, String columnName);  }
@Test public void should_return_string_cursor_data() { when(cursor.getColumnIndexOrThrow("column_name")).thenReturn(42); when(cursor.getString(42)).thenReturn("string-data"); String result = Database.getString(cursor, "column_name"); assertThat(result).isEqualTo("string-data"); }