### Question:
Program extends BaseProgram implements Comparable<Program> { @Override public ContentValues toContentValues() { ContentValues values = super.toContentValues(); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { values.remove(Programs.COLUMN_RECORDING_PROHIBITED); } return values; } private  Program(Builder builder); long getChannelId(); long getStartTimeUtcMillis(); long getEndTimeUtcMillis(); String[] getBroadcastGenres(); boolean isRecordingProhibited(); @Override int hashCode(); @Override boolean equals(Object other); @Override int compareTo(@NonNull Program other); @Override String toString(); @Override ContentValues toContentValues(); static Program fromCursor(Cursor cursor); @RestrictTo(LIBRARY_GROUP)
    static final String[] PROJECTION; }### Answer:
@Test public void testChannelWithSystemContentProvider() { if (!Utils.hasTvInputFramework(InstrumentationRegistry.getContext())) { return; } Channel channel = new Channel.Builder() .setInputId("TestInputService") .setType(TvContractCompat.Channels.TYPE_OTHER) .build(); ContentResolver resolver = InstrumentationRegistry.getContext().getContentResolver(); Uri channelUri = resolver.insert(Channels.CONTENT_URI, channel.toContentValues()); assertNotNull(channelUri); Program fullyPopulatedProgram = createFullyPopulatedProgram(ContentUris.parseId(channelUri)); Uri programUri = resolver.insert(Programs.CONTENT_URI, fullyPopulatedProgram.toContentValues()); Program programFromSystemDb = loadProgramFromContentProvider(resolver, programUri); compareProgram(fullyPopulatedProgram, programFromSystemDb, false); }
@Test public void testProgramUpdateWithContentProvider() { if (!Utils.hasTvInputFramework(InstrumentationRegistry.getContext())) { return; } Channel channel = new Channel.Builder() .setInputId("TestInputService") .setType(TvContractCompat.Channels.TYPE_OTHER) .build(); ContentResolver resolver = InstrumentationRegistry.getContext().getContentResolver(); Uri channelUri = resolver.insert(Channels.CONTENT_URI, channel.toContentValues()); assertNotNull(channelUri); Program fullyPopulatedProgram = createFullyPopulatedProgram(ContentUris.parseId(channelUri)); Uri programUri = resolver.insert(Programs.CONTENT_URI, fullyPopulatedProgram.toContentValues()); Program programFromSystemDb = loadProgramFromContentProvider(resolver, programUri); compareProgram(fullyPopulatedProgram, programFromSystemDb, false); Program updatedProgram = new Program.Builder(programFromSystemDb) .setDescription("description1").build(); assertEquals(1, resolver.update( programUri, updatedProgram.toContentValues(), null, null)); programFromSystemDb = loadProgramFromContentProvider(resolver, programUri); compareProgram(updatedProgram, programFromSystemDb, false); updatedProgram = new Program.Builder(updatedProgram) .setLongDescription(null).build(); assertEquals(1, resolver.update( programUri, updatedProgram.toContentValues(), null, null)); programFromSystemDb = loadProgramFromContentProvider(resolver, programUri); compareProgram(updatedProgram, programFromSystemDb, false); ContentValues values = new Program.Builder().setDescription("description2").build() .toContentValues(); assertEquals(1, values.size()); assertEquals(1, resolver.update(programUri, values, null, null)); programFromSystemDb = loadProgramFromContentProvider(resolver, programUri); Program expectedProgram = new Program.Builder(programFromSystemDb) .setDescription("description2").build(); compareProgram(expectedProgram, programFromSystemDb, false); }