@Test public void insertCallsInsertWithRightNameAndReturnsCorrectUri_withDifferentIncomingUri() { when(mSqLiteDatabase.insert(any(String.class), any(String.class), any(ContentValues.class))).thenReturn(Long.valueOf(1)); final Uri uri = Uri.parse("http: final Uri insertUri = mMockContent.insert(mContext, mSqLiteDatabase, new Path("PATH1/PATH2"), uri, null); verify(mSqLiteDatabase).insert(eq("NAME"), any(String.class), any(ContentValues.class)); assertThat(insertUri).isEqualTo(Uri.parse("http: }
public Uri insert(final Context context, final SQLiteDatabase sqLiteDatabase, final Path path, final Uri uri, final ContentValues values) { final String name = getName(context); final long id = sqLiteDatabase.insert(name, null, values); final String authority = uri.getAuthority(); final String scheme = uri.getScheme(); try { return UriUtilities.getUri(scheme, authority, path, id); } catch (final Exception exception){ } final Uri insertUri = UriUtilities.getUri(scheme, authority, path); return insertUri.buildUpon().appendPath(Long.toString(id)).build(); }
Content { public Uri insert(final Context context, final SQLiteDatabase sqLiteDatabase, final Path path, final Uri uri, final ContentValues values) { final String name = getName(context); final long id = sqLiteDatabase.insert(name, null, values); final String authority = uri.getAuthority(); final String scheme = uri.getScheme(); try { return UriUtilities.getUri(scheme, authority, path, id); } catch (final Exception exception){ } final Uri insertUri = UriUtilities.getUri(scheme, authority, path); return insertUri.buildUpon().appendPath(Long.toString(id)).build(); } }
Content { public Uri insert(final Context context, final SQLiteDatabase sqLiteDatabase, final Path path, final Uri uri, final ContentValues values) { final String name = getName(context); final long id = sqLiteDatabase.insert(name, null, values); final String authority = uri.getAuthority(); final String scheme = uri.getScheme(); try { return UriUtilities.getUri(scheme, authority, path, id); } catch (final Exception exception){ } final Uri insertUri = UriUtilities.getUri(scheme, authority, path); return insertUri.buildUpon().appendPath(Long.toString(id)).build(); }  }
Content { public Uri insert(final Context context, final SQLiteDatabase sqLiteDatabase, final Path path, final Uri uri, final ContentValues values) { final String name = getName(context); final long id = sqLiteDatabase.insert(name, null, values); final String authority = uri.getAuthority(); final String scheme = uri.getScheme(); try { return UriUtilities.getUri(scheme, authority, path, id); } catch (final Exception exception){ } final Uri insertUri = UriUtilities.getUri(scheme, authority, path); return insertUri.buildUpon().appendPath(Long.toString(id)).build(); }  abstract int getVersion(final Context context); abstract String getName(final Context context); abstract String getCreate(final Context context); abstract String getDrop(final Context context); abstract List<Path> getPaths(final Context context); void onUpgrade(final Context context, final SQLiteDatabase sqLiteDatabase, final int oldVersion); Cursor query(final Context context, final SQLiteDatabase sqLiteDatabase, final Path path, final Uri uri, final String[] projection, final String selection, final String[] selectionArgs, final String sortOrder); String type(final Context context, final SQLiteDatabase sqLiteDatabase, final Path path, final Uri uri); Uri insert(final Context context, final SQLiteDatabase sqLiteDatabase, final Path path, final Uri uri, final ContentValues values); int delete(final Context context, final SQLiteDatabase sqLiteDatabase, final Path path, final Uri uri, final String selection, final String[] selectionArgs); int update(final Context context, final SQLiteDatabase sqLiteDatabase, final Path path, final Uri uri, final ContentValues values, final String selection, final String[] selectionArgs); int bulkInsert(final Context context, final SQLiteDatabase sqLiteDatabase, final Path path, final Uri uri, final ContentValues[] contentValuesArray); }
Content { public Uri insert(final Context context, final SQLiteDatabase sqLiteDatabase, final Path path, final Uri uri, final ContentValues values) { final String name = getName(context); final long id = sqLiteDatabase.insert(name, null, values); final String authority = uri.getAuthority(); final String scheme = uri.getScheme(); try { return UriUtilities.getUri(scheme, authority, path, id); } catch (final Exception exception){ } final Uri insertUri = UriUtilities.getUri(scheme, authority, path); return insertUri.buildUpon().appendPath(Long.toString(id)).build(); }  abstract int getVersion(final Context context); abstract String getName(final Context context); abstract String getCreate(final Context context); abstract String getDrop(final Context context); abstract List<Path> getPaths(final Context context); void onUpgrade(final Context context, final SQLiteDatabase sqLiteDatabase, final int oldVersion); Cursor query(final Context context, final SQLiteDatabase sqLiteDatabase, final Path path, final Uri uri, final String[] projection, final String selection, final String[] selectionArgs, final String sortOrder); String type(final Context context, final SQLiteDatabase sqLiteDatabase, final Path path, final Uri uri); Uri insert(final Context context, final SQLiteDatabase sqLiteDatabase, final Path path, final Uri uri, final ContentValues values); int delete(final Context context, final SQLiteDatabase sqLiteDatabase, final Path path, final Uri uri, final String selection, final String[] selectionArgs); int update(final Context context, final SQLiteDatabase sqLiteDatabase, final Path path, final Uri uri, final ContentValues values, final String selection, final String[] selectionArgs); int bulkInsert(final Context context, final SQLiteDatabase sqLiteDatabase, final Path path, final Uri uri, final ContentValues[] contentValuesArray);  }