本文整理汇总了Java中android.test.MoreAsserts.assertContentsInAnyOrder方法的典型用法代码示例。如果您正苦于以下问题:Java MoreAsserts.assertContentsInAnyOrder方法的具体用法?Java MoreAsserts.assertContentsInAnyOrder怎么用?Java MoreAsserts.assertContentsInAnyOrder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.test.MoreAsserts
的用法示例。
在下文中一共展示了MoreAsserts.assertContentsInAnyOrder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testPickOneProgramPerEpisode_manyPerEpisode
import android.test.MoreAsserts; //导入方法依赖的package包/类
public void testPickOneProgramPerEpisode_manyPerEpisode() {
SeriesRecording seriesRecording = SeriesRecording.buildFrom(mBaseSeriesRecording)
.setId(SERIES_RECORDING_ID1).build();
mDataManager.addSeriesRecording(seriesRecording);
List<Program> programs = new ArrayList<>();
Program program1 = new Program.Builder(mBaseProgram).setSeasonNumber(SEASON_NUMBER1)
.setEpisodeNumber(EPISODE_NUMBER1).setStartTimeUtcMillis(0).build();
programs.add(program1);
Program program2 = new Program.Builder(program1).setStartTimeUtcMillis(1).build();
programs.add(program2);
Program program3 = new Program.Builder(mBaseProgram).setSeasonNumber(SEASON_NUMBER2)
.setEpisodeNumber(EPISODE_NUMBER2).build();
programs.add(program3);
Program program4 = new Program.Builder(program1).setStartTimeUtcMillis(1).build();
programs.add(program4);
LongSparseArray<List<Program>> result = SeriesRecordingScheduler.pickOneProgramPerEpisode(
mDataManager, Collections.singletonList(seriesRecording), programs);
MoreAsserts.assertContentsInAnyOrder(result.get(SERIES_RECORDING_ID1), program1, program3);
}
示例2: testRecommendChannels_includeRecommendedOnly_fewChannelsHaveScore
import android.test.MoreAsserts; //导入方法依赖的package包/类
public void testRecommendChannels_includeRecommendedOnly_fewChannelsHaveScore() {
createRecommender(true, START_DATAMANAGER_RUNNABLE_ADD_FOUR_CHANNELS);
mEvaluator.setChannelScore(mChannel_1.getId(), 1.0);
mEvaluator.setChannelScore(mChannel_2.getId(), 1.0);
// Only two channels are recommended because recommender doesn't recommend other channels.
MoreAsserts.assertContentsInAnyOrder(mRecommender.recommendChannels(),
mChannel_1, mChannel_2);
assertEquals(0, mRecommender.recommendChannels(-5).size());
assertEquals(0, mRecommender.recommendChannels(0).size());
MoreAsserts.assertContentsInAnyOrder(mRecommender.recommendChannels(3),
mChannel_1, mChannel_2);
MoreAsserts.assertContentsInAnyOrder(mRecommender.recommendChannels(4),
mChannel_1, mChannel_2);
MoreAsserts.assertContentsInAnyOrder(mRecommender.recommendChannels(5),
mChannel_1, mChannel_2);
}
示例3: testRecommendChannels_notIncludeRecommendedOnly_fewChannelsHaveScore
import android.test.MoreAsserts; //导入方法依赖的package包/类
public void testRecommendChannels_notIncludeRecommendedOnly_fewChannelsHaveScore() {
createRecommender(false, START_DATAMANAGER_RUNNABLE_ADD_FOUR_CHANNELS);
mEvaluator.setChannelScore(mChannel_1.getId(), 1.0);
mEvaluator.setChannelScore(mChannel_2.getId(), 1.0);
assertEquals(4, mRecommender.recommendChannels().size());
MoreAsserts.assertContentsInAnyOrder(mRecommender.recommendChannels().subList(0, 2),
mChannel_1, mChannel_2);
assertEquals(0, mRecommender.recommendChannels(-5).size());
assertEquals(0, mRecommender.recommendChannels(0).size());
assertEquals(3, mRecommender.recommendChannels(3).size());
MoreAsserts.assertContentsInAnyOrder(mRecommender.recommendChannels(3).subList(0, 2),
mChannel_1, mChannel_2);
assertEquals(4, mRecommender.recommendChannels(4).size());
MoreAsserts.assertContentsInAnyOrder(mRecommender.recommendChannels(4).subList(0, 2),
mChannel_1, mChannel_2);
assertEquals(4, mRecommender.recommendChannels(5).size());
MoreAsserts.assertContentsInAnyOrder(mRecommender.recommendChannels(5).subList(0, 2),
mChannel_1, mChannel_2);
}
示例4: testUpdate
import android.test.MoreAsserts; //导入方法依赖的package包/类
public void testUpdate() throws Exception {
addSomeRecords();
// check updates with existing records - that it doesn't increase the records.
accountDb.update("[email protected]", SECRET, "[email protected]", OtpType.TOTP, null);
accountDb.getNames(result);
MoreAsserts.assertContentsInAnyOrder(result,
"[email protected]", "[email protected]", "[email protected]");
// add new record.
accountDb.update("[email protected]", SECRET, "[email protected]", OtpType.TOTP, null);
result.clear();
accountDb.getNames(result);
MoreAsserts.assertContentsInAnyOrder(result,
"[email protected]", "[email protected]", "[email protected]");
// re-update with the original name
accountDb.update("[email protected]", SECRET, "[email protected]", OtpType.TOTP, null);
result.clear();
accountDb.getNames(result);
MoreAsserts.assertContentsInAnyOrder(result,
"[email protected]", "[email protected]", "[email protected]");
}
示例5: testConstruct_whenDatabaseWithoutProviderColumn
import android.test.MoreAsserts; //导入方法依赖的package包/类
public void testConstruct_whenDatabaseWithoutProviderColumn() {
deleteAccountDb();
SQLiteDatabase database =
DependencyInjector.getContext().openOrCreateDatabase(
AccountDb.PATH, Context.MODE_PRIVATE, null);
database.execSQL("CREATE TABLE " + AccountDb.TABLE_NAME + " (first INTEGER)");
MoreAsserts.assertContentsInAnyOrder(
AccountDb.listTableColumnNamesLowerCase(database, AccountDb.TABLE_NAME),
"first");
database.close();
database = null;
accountDb = DependencyInjector.getAccountDb();
MoreAsserts.assertContentsInAnyOrder(
AccountDb.listTableColumnNamesLowerCase(accountDb.mDatabase, AccountDb.TABLE_NAME),
"first", AccountDb.PROVIDER_COLUMN);
}
示例6: testUpdate
import android.test.MoreAsserts; //导入方法依赖的package包/类
public void testUpdate() throws Exception {
addSomeRecords();
// check updates with existing records - that it doesn't increase the records.
accountDb.update("[email protected]", SECRET, "[email protected]", OtpType.TOTP, null);
accountDb.getNames(result);
MoreAsserts.assertContentsInAnyOrder(result,
"[email protected]", "[email protected]", "[email protected]");
// add new record.
accountDb.update("[email protected]", SECRET, "[email protected]", OtpType.TOTP, null);
result.clear();
accountDb.getNames(result);
MoreAsserts.assertContentsInAnyOrder(result,
"[email protected]", "[email protected]", "[email protected]");
// re-update with the original name
accountDb.update("[email protected]", SECRET, "[email protected]", OtpType.TOTP, null);
result.clear();
accountDb.getNames(result);
MoreAsserts.assertContentsInAnyOrder(result,
"jo[email protected]", "[email protected]", "[email protected]");
}
示例7: testRun_oneRecordingsTomorrow
import android.test.MoreAsserts; //导入方法依赖的package包/类
public void testRun_oneRecordingsTomorrow() {
ScheduledRecording recording = addNewScheduledRecordingForTomorrow();
MoreAsserts
.assertContentsInAnyOrder(mDvrDataManager.getAllScheduledRecordings(), recording);
mReaper.run();
MoreAsserts
.assertContentsInAnyOrder(mDvrDataManager.getAllScheduledRecordings(), recording);
}
示例8: testRun_oneRecordingsStarted
import android.test.MoreAsserts; //导入方法依赖的package包/类
public void testRun_oneRecordingsStarted() {
ScheduledRecording recording = addNewScheduledRecordingForTomorrow();
MoreAsserts
.assertContentsInAnyOrder(mDvrDataManager.getAllScheduledRecordings(), recording);
mFakeClock.increment(TimeUnit.DAYS);
mReaper.run();
MoreAsserts
.assertContentsInAnyOrder(mDvrDataManager.getAllScheduledRecordings(), recording);
}
示例9: testRun_oneRecordingsFinished
import android.test.MoreAsserts; //导入方法依赖的package包/类
public void testRun_oneRecordingsFinished() {
ScheduledRecording recording = addNewScheduledRecordingForTomorrow();
MoreAsserts
.assertContentsInAnyOrder(mDvrDataManager.getAllScheduledRecordings(), recording);
mFakeClock.increment(TimeUnit.DAYS);
mFakeClock.increment(TimeUnit.MINUTES, 2);
mReaper.run();
MoreAsserts
.assertContentsInAnyOrder(mDvrDataManager.getAllScheduledRecordings(), recording);
}
示例10: testRun_oneRecordingsExpired
import android.test.MoreAsserts; //导入方法依赖的package包/类
public void testRun_oneRecordingsExpired() {
ScheduledRecording recording = addNewScheduledRecordingForTomorrow();
MoreAsserts
.assertContentsInAnyOrder(mDvrDataManager.getAllScheduledRecordings(), recording);
mFakeClock.increment(TimeUnit.DAYS, 1 + ScheduledProgramReaper.DAYS);
mFakeClock.increment(TimeUnit.MILLISECONDS, DURATION);
// After the cutoff and enough so we can see on the clock
mFakeClock.increment(TimeUnit.SECONDS, 1);
mReaper.run();
MoreAsserts.assertContentsInAnyOrder(
"Recordings after reaper at " + com.android.tv.util.Utils
.toIsoDateTimeString(mFakeClock.currentTimeMillis()),
mDvrDataManager.getAllScheduledRecordings());
}
示例11: testPickOneProgramPerEpisode_onePerEpisode
import android.test.MoreAsserts; //导入方法依赖的package包/类
public void testPickOneProgramPerEpisode_onePerEpisode() {
SeriesRecording seriesRecording = SeriesRecording.buildFrom(mBaseSeriesRecording)
.setId(SERIES_RECORDING_ID1).build();
mDataManager.addSeriesRecording(seriesRecording);
List<Program> programs = new ArrayList<>();
Program program1 = new Program.Builder(mBaseProgram).setSeasonNumber(SEASON_NUMBER1)
.setEpisodeNumber(EPISODE_NUMBER1).build();
programs.add(program1);
Program program2 = new Program.Builder(mBaseProgram).setSeasonNumber(SEASON_NUMBER2)
.setEpisodeNumber(EPISODE_NUMBER2).build();
programs.add(program2);
LongSparseArray<List<Program>> result = SeriesRecordingScheduler.pickOneProgramPerEpisode(
mDataManager, Collections.singletonList(seriesRecording), programs);
MoreAsserts.assertContentsInAnyOrder(result.get(SERIES_RECORDING_ID1), program1, program2);
}
示例12: testPickOneProgramPerEpisode_nullEpisode
import android.test.MoreAsserts; //导入方法依赖的package包/类
public void testPickOneProgramPerEpisode_nullEpisode() {
SeriesRecording seriesRecording = SeriesRecording.buildFrom(mBaseSeriesRecording)
.setId(SERIES_RECORDING_ID1).build();
mDataManager.addSeriesRecording(seriesRecording);
List<Program> programs = new ArrayList<>();
Program program1 = new Program.Builder(mBaseProgram).setStartTimeUtcMillis(0).build();
programs.add(program1);
Program program2 = new Program.Builder(mBaseProgram).setStartTimeUtcMillis(1).build();
programs.add(program2);
LongSparseArray<List<Program>> result = SeriesRecordingScheduler.pickOneProgramPerEpisode(
mDataManager, Collections.singletonList(seriesRecording), programs);
MoreAsserts.assertContentsInAnyOrder(result.get(SERIES_RECORDING_ID1), program1, program2);
}
示例13: testBrowsable
import android.test.MoreAsserts; //导入方法依赖的package包/类
/**
* Test for following methods and channel listener with notifying change.
* - {@link ChannelDataManager#updateBrowsable}
* - {@link ChannelDataManager#applyUpdatedValuesToDb}
*/
@UiThreadTest
public void testBrowsable() throws Exception {
startAndWaitForComplete();
// Test if all channels are browsable
List<Channel> channelList = new ArrayList<>(mChannelDataManager.getChannelList());
List<Channel> browsableChannelList = mChannelDataManager.getBrowsableChannelList();
for (Channel browsableChannel : browsableChannelList) {
boolean found = channelList.remove(browsableChannel);
assertTrue("Cannot find (" + browsableChannel + ")", found);
}
assertEquals(0, channelList.size());
// Prepare for next tests.
TestChannelDataManagerChannelListener channelListener =
new TestChannelDataManagerChannelListener();
Channel channel1 = mChannelDataManager.getChannelList().get(0);
mChannelDataManager.addChannelListener(channel1.getId(), channelListener);
// Test {@link ChannelDataManager#updateBrowsable} & notification.
mChannelDataManager.updateBrowsable(channel1.getId(), false, false);
assertTrue(mListener.channelBrowsableChangedCalled);
assertFalse(mChannelDataManager.getBrowsableChannelList().contains(channel1));
MoreAsserts.assertContentsInAnyOrder(channelListener.updatedChannels, channel1);
channelListener.reset();
// Test {@link ChannelDataManager#applyUpdatedValuesToDb}
// Disable the update notification to avoid the unwanted call of "onLoadFinished".
mContentResolver.mNotifyDisabled = true;
mChannelDataManager.applyUpdatedValuesToDb();
restart();
browsableChannelList = mChannelDataManager.getBrowsableChannelList();
assertEquals(Constants.UNIT_TEST_CHANNEL_COUNT - 1, browsableChannelList.size());
assertFalse(browsableChannelList.contains(channel1));
}
示例14: testGetNames
import android.test.MoreAsserts; //导入方法依赖的package包/类
public void testGetNames() throws Exception {
addSomeRecords();
accountDb.getNames(result);
MoreAsserts.assertContentsInAnyOrder(result,
"[email protected]", "[email protected]", "[email protected]");
// check nameExists()
assertTrue(accountDb.nameExists("[email protected]"));
assertTrue(accountDb.nameExists("[email protected]"));
assertTrue(accountDb.nameExists("[email protected]"));
assertFalse(accountDb.nameExists("[email protected]")); // non-existent email.
}
示例15: testRun_noRecordings
import android.test.MoreAsserts; //导入方法依赖的package包/类
public void testRun_noRecordings() {
MoreAsserts.assertContentsInAnyOrder(mDvrDataManager.getAllScheduledRecordings());
mReaper.run();
MoreAsserts.assertContentsInAnyOrder(mDvrDataManager.getAllScheduledRecordings());
}