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


Java MoreAsserts.assertNotEqual方法代码示例

本文整理汇总了Java中android.test.MoreAsserts.assertNotEqual方法的典型用法代码示例。如果您正苦于以下问题:Java MoreAsserts.assertNotEqual方法的具体用法?Java MoreAsserts.assertNotEqual怎么用?Java MoreAsserts.assertNotEqual使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.test.MoreAsserts的用法示例。


在下文中一共展示了MoreAsserts.assertNotEqual方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:RealmConfigurationTests.java

示例2: testEquals

import android.test.MoreAsserts; //导入方法依赖的package包/类
public void testEquals() {
  DrmInitData drmInitData = new DrmInitData(DATA_1, DATA_2);

  // Basic non-referential equality test.
  DrmInitData testInitData = new DrmInitData(DATA_1, DATA_2);
  assertEquals(drmInitData, testInitData);
  assertEquals(drmInitData.hashCode(), testInitData.hashCode());

  // Basic non-referential equality test with non-referential scheme data.
  testInitData = new DrmInitData(DATA_1B, DATA_2B);
  assertEquals(drmInitData, testInitData);
  assertEquals(drmInitData.hashCode(), testInitData.hashCode());

  // Passing the scheme data in reverse order shouldn't affect equality.
  testInitData = new DrmInitData(DATA_2, DATA_1);
  assertEquals(drmInitData, testInitData);
  assertEquals(drmInitData.hashCode(), testInitData.hashCode());

  // Ditto.
  testInitData = new DrmInitData(DATA_2B, DATA_1B);
  assertEquals(drmInitData, testInitData);
  assertEquals(drmInitData.hashCode(), testInitData.hashCode());

  // Different number of tuples should affect equality.
  testInitData = new DrmInitData(DATA_1);
  MoreAsserts.assertNotEqual(drmInitData, testInitData);

  // Different data in one of the tuples should affect equality.
  testInitData = new DrmInitData(DATA_1, DATA_UNIVERSAL);
  MoreAsserts.assertNotEqual(drmInitData, testInitData);
}
 
开发者ID:zhanglibin123488,项目名称:videoPickPlayer,代码行数:32,代码来源:DrmInitDataTest.java

示例3: testOutputCanBeReadUsingStandardGzipInputStream

import android.test.MoreAsserts; //导入方法依赖的package包/类
public void testOutputCanBeReadUsingStandardGzipInputStream() throws IOException {
    final File tempFile = File.createTempFile("tmp", ".gz");

    final ByteArrayOutputStream standardStream = new ByteArrayOutputStream();
    final FlushableGzipOutputStream zippedStream = new FlushableGzipOutputStream(tempFile);

    for (byte i = 0; i < 100; ++ i) {
        final byte[] buffer = {i, i, i, i, i, i, i, i, i, i, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, i, i, i, i, i, i, i, i};
        for (int j = 0; j < buffer.length; ++ j) {
            standardStream.write(buffer, j, buffer.length - j);
            zippedStream.write(buffer, j, buffer.length - j);
        }
        zippedStream.flush();
    }

    // DO NOT CLOSE THE STREAM. We are here to check whether flush() can write everything without the final close.

    final byte[] expected = standardStream.toByteArray();

    MoreAsserts.assertNotEqual(0, tempFile.length());
    assertTrue(tempFile.length() < expected.length);

    final GZIPInputStream inputStream = new GZIPInputStream(new FileInputStream(tempFile));
    final ByteArrayOutputStream actualStream = new ByteArrayOutputStream();
    try {
        ByteStreams.copy(inputStream, actualStream);
    } catch (final EOFException e) {
        // Ignore, we do expect an EOFException.
    }

    inputStream.close();

    MoreAsserts.assertEquals(expected, actualStream.toByteArray());

    tempFile.delete();
}
 
开发者ID:kennytm,项目名称:CatSaver,代码行数:37,代码来源:FlushableGzipOutputStreamTest.java

示例4: assertSortKeyNotInvalid

import android.test.MoreAsserts; //导入方法依赖的package包/类
private void assertSortKeyNotInvalid(List<Channel> channelList) {
    for (Channel channel : channelList) {
        MoreAsserts.assertNotEqual(Recommender.INVALID_CHANNEL_SORT_KEY,
                mRecommender.getChannelSortKey(channel.getId()));
    }
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:7,代码来源:RecommenderTest.java


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