当前位置: 首页>>代码示例>>Java>>正文


Java MoreAsserts.assertContentsInAnyOrder方法代码示例

本文整理汇总了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);
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:20,代码来源:SeriesRecordingSchedulerTest.java

示例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);
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:19,代码来源:RecommenderTest.java

示例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);
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:26,代码来源:RecommenderTest.java

示例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]");
}
 
开发者ID:ocdtrekkie,项目名称:authenticator,代码行数:21,代码来源:AccountDbTest.java

示例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);
}
 
开发者ID:ocdtrekkie,项目名称:authenticator,代码行数:18,代码来源:AccountDbTest.java

示例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]");
}
 
开发者ID:google,项目名称:google-authenticator-android,代码行数:21,代码来源:AccountDbTest.java

示例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);
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:9,代码来源:ScheduledProgramReaperTest.java

示例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);
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:10,代码来源:ScheduledProgramReaperTest.java

示例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);
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:11,代码来源:ScheduledProgramReaperTest.java

示例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());
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:16,代码来源:ScheduledProgramReaperTest.java

示例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);
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:16,代码来源:SeriesRecordingSchedulerTest.java

示例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);
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:14,代码来源:SeriesRecordingSchedulerTest.java

示例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));
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:41,代码来源:ChannelDataManagerTest.java

示例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.
}
 
开发者ID:ocdtrekkie,项目名称:authenticator,代码行数:13,代码来源:AccountDbTest.java

示例15: testRun_noRecordings

import android.test.MoreAsserts; //导入方法依赖的package包/类
public void testRun_noRecordings() {
    MoreAsserts.assertContentsInAnyOrder(mDvrDataManager.getAllScheduledRecordings());
    mReaper.run();
    MoreAsserts.assertContentsInAnyOrder(mDvrDataManager.getAllScheduledRecordings());
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:6,代码来源:ScheduledProgramReaperTest.java


注:本文中的android.test.MoreAsserts.assertContentsInAnyOrder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。