本文整理汇总了Java中android.test.MoreAsserts类的典型用法代码示例。如果您正苦于以下问题:Java MoreAsserts类的具体用法?Java MoreAsserts怎么用?Java MoreAsserts使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MoreAsserts类属于android.test包,在下文中一共展示了MoreAsserts类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: encryptionKey_keyStorage
import android.test.MoreAsserts; //导入依赖的package包/类
@Test
public void encryptionKey_keyStorage() throws Exception {
// Generates a key and uses it in a RealmConfiguration.
byte[] oldKey = TestHelper.getRandomKey(12345);
byte[] key = oldKey;
RealmConfiguration config = new RealmConfiguration.Builder(context)
.directory(configFactory.getRoot())
.encryptionKey(key)
.build();
// Generates a different key and assigns it to the same variable.
byte[] newKey = TestHelper.getRandomKey(67890);
MoreAsserts.assertNotEqual(key, newKey);
key = newKey;
MoreAsserts.assertEquals(key, newKey);
// Ensures that the stored key did not change.
MoreAsserts.assertEquals(oldKey, config.getEncryptionKey());
}
示例2: assertEquals
import android.test.MoreAsserts; //导入依赖的package包/类
public void assertEquals(FakeTrackOutput expected) {
Assert.assertEquals(expected.format, format);
Assert.assertEquals(expected.sampleTimesUs.size(), sampleTimesUs.size());
MoreAsserts.assertEquals(expected.sampleData, sampleData);
for (int i = 0; i < sampleTimesUs.size(); i++) {
Assert.assertEquals(expected.sampleTimesUs.get(i), sampleTimesUs.get(i));
Assert.assertEquals(expected.sampleFlags.get(i), sampleFlags.get(i));
Assert.assertEquals(expected.sampleStartOffsets.get(i), sampleStartOffsets.get(i));
Assert.assertEquals(expected.sampleEndOffsets.get(i), sampleEndOffsets.get(i));
if (expected.sampleEncryptionKeys.get(i) == null) {
Assert.assertNull(sampleEncryptionKeys.get(i));
} else {
MoreAsserts.assertEquals(expected.sampleEncryptionKeys.get(i), sampleEncryptionKeys.get(i));
}
}
}
示例3: testTranslateComputerBraille
import android.test.MoreAsserts; //导入依赖的package包/类
/** Tests that the translator service can translate computer braille. */
public void testTranslateComputerBraille() throws Exception {
ITranslatorService service = getServiceInterface();
assertTrue("expected braille table check to succeed",
service.checkTable(TEST_BRAILLE_TABLE_ID));
TranslationResult result = service.translate("Hello!",
TEST_BRAILLE_TABLE_ID, -1);
MoreAsserts.assertEquals(
new byte[] { 0x53, 0x11, 0x07, 0x07, 0x15, 0x2e },
result.getCells());
MoreAsserts.assertEquals(new int[] { 0, 1, 2, 3, 4, 5 },
result.getTextToBraillePositions());
MoreAsserts.assertEquals(new int[] { 0, 1, 2, 3, 4, 5 },
result.getBrailleToTextPositions());
assertEquals(-1, result.getCursorPosition());
}
示例4: testGetConflictingSchedules_noConflict
import android.test.MoreAsserts; //导入依赖的package包/类
public void testGetConflictingSchedules_noConflict() {
long priority = 0;
long channelId = 0;
List<ScheduledRecording> schedules = new ArrayList<>();
schedules.add(RecordingTestUtils.createTestRecordingWithPriorityAndPeriod(++channelId,
++priority, 0L, 200L));
MoreAsserts.assertEmpty(DvrScheduleManager.getConflictingSchedules(schedules, 1));
schedules.add(RecordingTestUtils.createTestRecordingWithPriorityAndPeriod(++channelId,
++priority, 0L, 100L));
MoreAsserts.assertEmpty(DvrScheduleManager.getConflictingSchedules(schedules, 2));
schedules.add(RecordingTestUtils.createTestRecordingWithPriorityAndPeriod(++channelId,
++priority, 100L, 200L));
MoreAsserts.assertEmpty(DvrScheduleManager.getConflictingSchedules(schedules, 2));
schedules.add(RecordingTestUtils.createTestRecordingWithPriorityAndPeriod(++channelId,
++priority, 0L, 100L));
MoreAsserts.assertEmpty(DvrScheduleManager.getConflictingSchedules(schedules, 3));
schedules.add(RecordingTestUtils.createTestRecordingWithPriorityAndPeriod(++channelId,
++priority, 100L, 200L));
MoreAsserts.assertEmpty(DvrScheduleManager.getConflictingSchedules(schedules, 3));
}
示例5: testGetConflictingSchedules_conflict2
import android.test.MoreAsserts; //导入依赖的package包/类
public void testGetConflictingSchedules_conflict2() {
// The case when there is a long schedule.
long priority = 0;
long channelId = 0;
List<ScheduledRecording> schedules = new ArrayList<>();
ScheduledRecording r1 = RecordingTestUtils.createTestRecordingWithPriorityAndPeriod(
++channelId, ++priority, 0L, 1000L);
schedules.add(r1);
MoreAsserts.assertEmpty(DvrScheduleManager.getConflictingSchedules(schedules, 1));
ScheduledRecording r2 = RecordingTestUtils.createTestRecordingWithPriorityAndPeriod(
++channelId, ++priority, 0L, 100L);
schedules.add(r2);
MoreAsserts.assertContentsInOrder(DvrScheduleManager.getConflictingSchedules(schedules, 1),
r1);
MoreAsserts.assertEmpty(DvrScheduleManager.getConflictingSchedules(schedules, 2));
ScheduledRecording r3 = RecordingTestUtils.createTestRecordingWithPriorityAndPeriod(
++channelId, ++priority, 100L, 200L);
schedules.add(r3);
MoreAsserts.assertContentsInOrder(DvrScheduleManager.getConflictingSchedules(schedules, 1),
r1);
MoreAsserts.assertEmpty(DvrScheduleManager.getConflictingSchedules(schedules, 2));
}
示例6: testGetConflictingSchedules_period1
import android.test.MoreAsserts; //导入依赖的package包/类
public void testGetConflictingSchedules_period1() {
long priority = 0;
long channelId = 0;
List<ScheduledRecording> schedules = new ArrayList<>();
ScheduledRecording r1 = RecordingTestUtils.createTestRecordingWithPriorityAndPeriod(
++channelId, ++priority, 0L, 200L);
schedules.add(r1);
ScheduledRecording r2 = RecordingTestUtils.createTestRecordingWithPriorityAndPeriod(
++channelId, ++priority, 0L, 100L);
schedules.add(r2);
MoreAsserts.assertContentsInOrder(DvrScheduleManager.getConflictingSchedules(schedules, 1,
Collections.singletonList(new Range<>(10L, 20L))), r1);
MoreAsserts.assertContentsInOrder(DvrScheduleManager.getConflictingSchedules(schedules, 1,
Collections.singletonList(new Range<>(110L, 120L))), r1);
}
示例7: testGetConflictingSchedules_period2
import android.test.MoreAsserts; //导入依赖的package包/类
public void testGetConflictingSchedules_period2() {
long priority = 0;
long channelId = 0;
List<ScheduledRecording> schedules = new ArrayList<>();
ScheduledRecording r1 = RecordingTestUtils.createTestRecordingWithPriorityAndPeriod(
++channelId, ++priority, 0L, 200L);
schedules.add(r1);
ScheduledRecording r2 = RecordingTestUtils.createTestRecordingWithPriorityAndPeriod(
++channelId, ++priority, 100L, 200L);
schedules.add(r2);
MoreAsserts.assertContentsInOrder(DvrScheduleManager.getConflictingSchedules(schedules, 1,
Collections.singletonList(new Range<>(10L, 20L))), r1);
MoreAsserts.assertContentsInOrder(DvrScheduleManager.getConflictingSchedules(schedules, 1,
Collections.singletonList(new Range<>(110L, 120L))), r1);
}
示例8: testGetConflictingSchedules_addSchedules1
import android.test.MoreAsserts; //导入依赖的package包/类
public void testGetConflictingSchedules_addSchedules1() {
long priority = 0;
long channelId = 0;
List<ScheduledRecording> schedules = new ArrayList<>();
ScheduledRecording r1 = RecordingTestUtils.createTestRecordingWithPriorityAndPeriod(
++channelId, ++priority, 0L, 200L);
schedules.add(r1);
ScheduledRecording r2 = RecordingTestUtils.createTestRecordingWithPriorityAndPeriod(
++channelId, ++priority, 0L, 100L);
schedules.add(r2);
MoreAsserts.assertContentsInOrder(DvrScheduleManager.getConflictingSchedules(
Collections.singletonList(
ScheduledRecording.builder(INPUT_ID, ++channelId, 10L, 20L)
.setPriority(++priority).build()),
schedules, 1), r2, r1);
MoreAsserts.assertContentsInOrder(DvrScheduleManager.getConflictingSchedules(
Collections.singletonList(
ScheduledRecording.builder(INPUT_ID, ++channelId, 110L, 120L)
.setPriority(++priority).build()),
schedules, 1), r1);
}
示例9: testGetConflictingSchedules_addSchedules2
import android.test.MoreAsserts; //导入依赖的package包/类
public void testGetConflictingSchedules_addSchedules2() {
long priority = 0;
long channelId = 0;
List<ScheduledRecording> schedules = new ArrayList<>();
ScheduledRecording r1 = RecordingTestUtils.createTestRecordingWithPriorityAndPeriod(
++channelId, ++priority, 0L, 200L);
schedules.add(r1);
ScheduledRecording r2 = RecordingTestUtils.createTestRecordingWithPriorityAndPeriod(
++channelId, ++priority, 100L, 200L);
schedules.add(r2);
MoreAsserts.assertContentsInOrder(DvrScheduleManager.getConflictingSchedules(
Collections.singletonList(
ScheduledRecording.builder(INPUT_ID, ++channelId, 10L, 20L)
.setPriority(++priority).build()),
schedules, 1), r1);
MoreAsserts.assertContentsInOrder(DvrScheduleManager.getConflictingSchedules(
Collections.singletonList(
ScheduledRecording.builder(INPUT_ID, ++channelId, 110L, 120L)
.setPriority(++priority).build()),
schedules, 1), r2, r1);
}
示例10: testGetConflictingSchedules_addLowestPriority
import android.test.MoreAsserts; //导入依赖的package包/类
public void testGetConflictingSchedules_addLowestPriority() {
long priority = 0;
long channelId = 0;
List<ScheduledRecording> schedules = new ArrayList<>();
ScheduledRecording r1 = RecordingTestUtils.createTestRecordingWithPriorityAndPeriod(
++channelId, ++priority, 0L, 400L);
schedules.add(r1);
ScheduledRecording r2 = RecordingTestUtils.createTestRecordingWithPriorityAndPeriod(
++channelId, ++priority, 100L, 200L);
schedules.add(r2);
// Returning r1 even though r1 has the higher priority than the new one. That's because r1
// starts at 0 and stops at 100, and the new one will be recorded successfully.
MoreAsserts.assertContentsInOrder(DvrScheduleManager.getConflictingSchedules(
Collections.singletonList(
ScheduledRecording.builder(INPUT_ID, ++channelId, 200L, 300L)
.setPriority(0).build()),
schedules, 1), r1);
}
示例11: testGetConflictingSchedule_startEarlyAndFail
import android.test.MoreAsserts; //导入依赖的package包/类
public void testGetConflictingSchedule_startEarlyAndFail() {
long priority = 0;
long channelId = 0;
List<ScheduledRecording> schedules = new ArrayList<>();
ScheduledRecording r1 = RecordingTestUtils.createTestRecordingWithPriorityAndPeriod(
++channelId, ++priority, 200L, 300L);
schedules.add(r1);
ScheduledRecording r2 = RecordingTestUtils.createTestRecordingWithPriorityAndPeriod(
++channelId, ++priority, 0L, 400L);
schedules.add(r2);
ScheduledRecording r3 = RecordingTestUtils.createTestRecordingWithPriorityAndPeriod(
++channelId, ++priority, 100L, 200L);
schedules.add(r3);
// r2 starts recording and fails when r3 starts. r1 is recorded successfully.
MoreAsserts.assertContentsInOrder(DvrScheduleManager.getConflictingSchedules(schedules, 1),
r2);
}
示例12: testGetConflictingSchedule_startLate
import android.test.MoreAsserts; //导入依赖的package包/类
public void testGetConflictingSchedule_startLate() {
long priority = 0;
long channelId = 0;
List<ScheduledRecording> schedules = new ArrayList<>();
ScheduledRecording r1 = RecordingTestUtils.createTestRecordingWithPriorityAndPeriod(
++channelId, ++priority, 200L, 400L);
schedules.add(r1);
ScheduledRecording r2 = RecordingTestUtils.createTestRecordingWithPriorityAndPeriod(
++channelId, ++priority, 100L, 300L);
schedules.add(r2);
ScheduledRecording r3 = RecordingTestUtils.createTestRecordingWithPriorityAndPeriod(
++channelId, ++priority, 0L, 200L);
schedules.add(r3);
// r2 and r1 are clipped.
MoreAsserts.assertContentsInOrder(DvrScheduleManager.getConflictingSchedules(schedules, 1),
r2, r1);
}
示例13: testGetConflictingSchedulesForWatching_otherChannels
import android.test.MoreAsserts; //导入依赖的package包/类
public void testGetConflictingSchedulesForWatching_otherChannels() {
// The other channels are to be recorded.
long priority = 0;
long channelToWatch = 1;
long channelId = 1;
List<ScheduledRecording> schedules = new ArrayList<>();
ScheduledRecording r1 = RecordingTestUtils.createTestRecordingWithPriorityAndPeriod(
++channelId, ++priority, 0L, 200L);
schedules.add(r1);
ScheduledRecording r2 = RecordingTestUtils.createTestRecordingWithPriorityAndPeriod(
++channelId, ++priority, 0L, 200L);
schedules.add(r2);
MoreAsserts.assertEmpty(DvrScheduleManager.getConflictingSchedulesForWatching(
INPUT_ID, channelToWatch, 0L, ++priority, schedules, 3));
MoreAsserts.assertContentsInOrder(DvrScheduleManager.getConflictingSchedulesForWatching(
INPUT_ID, channelToWatch, 0L, ++priority, schedules, 2), r1);
}
示例14: testGetConflictingSchedulesForWatching_sameChannel1
import android.test.MoreAsserts; //导入依赖的package包/类
public void testGetConflictingSchedulesForWatching_sameChannel1() {
long priority = 0;
long channelToWatch = 1;
long channelId = 1;
List<ScheduledRecording> schedules = new ArrayList<>();
ScheduledRecording r1 = RecordingTestUtils.createTestRecordingWithPriorityAndPeriod(
channelToWatch, ++priority, 0L, 200L);
schedules.add(r1);
ScheduledRecording r2 = RecordingTestUtils.createTestRecordingWithPriorityAndPeriod(
++channelId, ++priority, 0L, 200L);
schedules.add(r2);
MoreAsserts.assertEmpty(DvrScheduleManager.getConflictingSchedulesForWatching(
INPUT_ID, channelToWatch, 0L, ++priority, schedules, 2));
MoreAsserts.assertContentsInOrder(DvrScheduleManager.getConflictingSchedulesForWatching(
INPUT_ID, channelToWatch, 0L, ++priority, schedules, 1), r2);
}
示例15: testGetConflictingSchedulesForWatching_sameChannel2
import android.test.MoreAsserts; //导入依赖的package包/类
public void testGetConflictingSchedulesForWatching_sameChannel2() {
long priority = 0;
long channelToWatch = 1;
long channelId = 1;
List<ScheduledRecording> schedules = new ArrayList<>();
ScheduledRecording r1 = RecordingTestUtils.createTestRecordingWithPriorityAndPeriod(
++channelId, ++priority, 0L, 200L);
schedules.add(r1);
ScheduledRecording r2 = RecordingTestUtils.createTestRecordingWithPriorityAndPeriod(
channelToWatch, ++priority, 0L, 200L);
schedules.add(r2);
MoreAsserts.assertEmpty(DvrScheduleManager.getConflictingSchedulesForWatching(
INPUT_ID, channelToWatch, 0L, ++priority, schedules, 2));
MoreAsserts.assertContentsInOrder(DvrScheduleManager.getConflictingSchedulesForWatching(
INPUT_ID, channelToWatch, 0L, ++priority, schedules, 1), r1);
}