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


Java MoreAsserts.assertMatchesRegex方法代码示例

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


在下文中一共展示了MoreAsserts.assertMatchesRegex方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testMultipleRecordsFromSameTestWithName

import android.test.MoreAsserts; //导入方法依赖的package包/类
@Test
public void testMultipleRecordsFromSameTestWithName() throws Throwable {
  mAlbumImpl.addRecord(
      new RecordBuilderImpl(null).setName("foo").setTiling(Tiling.singleTile(mFooFile)));

  try {
    mAlbumImpl.addRecord(
        new RecordBuilderImpl(null).setName("foo").setTiling(Tiling.singleTile(mFooFile)));
  } catch (AssertionError e) {
    MoreAsserts.assertMatchesRegex(".*same name.*", e.getMessage());
    return;
  }
  fail("expected to see an exception");
}
 
开发者ID:facebook,项目名称:screenshot-tests-for-android,代码行数:15,代码来源:AlbumImplTest.java

示例2: testIncompleteTiles

import android.test.MoreAsserts; //导入方法依赖的package包/类
public void testIncompleteTiles() throws Throwable {
  RecordBuilderImpl recordBuilder =
      new RecordBuilderImpl(mScreenshotImpl).setTiling(new Tiling(3, 4));

  try {
    recordBuilder.record();
    fail("expected exception");
  } catch (IllegalStateException e) {
    MoreAsserts.assertMatchesRegex(".*tiles.*", e.getMessage());
  }
}
 
开发者ID:facebook,项目名称:screenshot-tests-for-android,代码行数:12,代码来源:RecordBuilderImplTest.java

示例3: testCannotCallgetBitmapAfterRecord

import android.test.MoreAsserts; //导入方法依赖的package包/类
@Test
public void testCannotCallgetBitmapAfterRecord() throws Throwable {
  try {
    RecordBuilderImpl rb = mScreenshot.snap(mTextView);
    rb.record();
    rb.getBitmap();
    fail("expected exception");
  } catch (IllegalArgumentException e) {
    MoreAsserts.assertMatchesRegex(".*after.*record.*", e.getMessage());
  }
}
 
开发者ID:facebook,项目名称:screenshot-tests-for-android,代码行数:12,代码来源:ScreenshotImplTest.java

示例4: testCorrectVersion

import android.test.MoreAsserts; //导入方法依赖的package包/类
public void testCorrectVersion() throws Exception {
    PackageInfo info = application.getPackageManager().getPackageInfo(application.getPackageName(), 0);
    assertNotNull(info);
    MoreAsserts.assertMatchesRegex("\\d\\.\\d", info.versionName);
}
 
开发者ID:mrspaceman,项目名称:ebookmgr,代码行数:6,代码来源:ApplicationTest.java

示例5: testRecordWithTiles

import android.test.MoreAsserts; //导入方法依赖的package包/类
@Test
public void testRecordWithTiles() throws Throwable {
  final int WIDTH = 3;
  final int HEIGHT = 4;

  RecordBuilderImpl builder =
      new RecordBuilderImpl(null).setName("foo").setTiling(new Tiling(WIDTH, HEIGHT));

  for (int i = 0; i < WIDTH; i++) {
    for (int j = 0; j < HEIGHT; j++) {
      String tempName = mAlbumImpl.writeBitmap("foo", i, j, mSomeBitmap);
      builder.getTiling().setAt(i, j, tempName);
    }
  }

  mAlbumImpl.addRecord(builder);
  mAlbumImpl.flush();

  Document doc = parseMetadata();

  Element screenshots = (Element) doc.getElementsByTagName("screenshots").item(0);
  Element screenshot = (Element) screenshots.getElementsByTagName("screenshot").item(0);

  Element tileWidth = (Element) screenshot.getElementsByTagName("tile_width").item(0);
  Element tileHeight = (Element) screenshot.getElementsByTagName("tile_height").item(0);

  assertEquals(WIDTH, Integer.parseInt(tileWidth.getTextContent()));
  assertEquals(HEIGHT, Integer.parseInt(tileHeight.getTextContent()));

  NodeList fileNames = screenshot.getElementsByTagName("absolute_file_name");

  assertEquals(12, fileNames.getLength());
  String fourthFile = fileNames.item(4).getTextContent();
  MoreAsserts.assertMatchesRegex(
      "The x coordinate should be before y coordinate",
      ".*foo_2_3.png",
      fileNames.item(11).getTextContent());

  MoreAsserts.assertMatchesRegex(".*foo_1_0.png", fourthFile);

  NodeList relativeFileNames = screenshot.getElementsByTagName("relative_file_name");

  assertEquals(12, relativeFileNames.getLength());
  String relativeFourthFile = relativeFileNames.item(4).getTextContent();
  assertEquals("foo_1_0.png", relativeFourthFile);
}
 
开发者ID:facebook,项目名称:screenshot-tests-for-android,代码行数:47,代码来源:AlbumImplTest.java

示例6: assertStartsWith

import android.test.MoreAsserts; //导入方法依赖的package包/类
protected void assertStartsWith(String expectedPrefix, String actual) {
    String regex = "^" + expectedPrefix + ".*";
    MoreAsserts.assertMatchesRegex(regex, actual);
}
 
开发者ID:wuyexiong,项目名称:android-downloadprovider,代码行数:5,代码来源:AbstractDownloadProviderFunctionalTest.java


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