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


Java TestName类代码示例

本文整理汇总了Java中org.junit.rules.TestName的典型用法代码示例。如果您正苦于以下问题:Java TestName类的具体用法?Java TestName怎么用?Java TestName使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: prepareDriver

import org.junit.rules.TestName; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void prepareDriver() throws Exception {
	testName = Mockito.mock(TestName.class);
	Mockito.when(testName.getMethodName()).thenReturn("mockTest");
	System.clearProperty("test.selenium.remote");
	localDriverClass = WebDriverMock.class.getName();
	remoteDriverClass = WebDriverMock.class.getName();
	scenario = "sc";
	super.prepareDriver();
	mockDriver = Mockito.mock(WebDriverMock.class);
	Mockito.when(((WebDriverMock) mockDriver).getScreenshotAs(ArgumentMatchers.any(OutputType.class))).thenReturn(
			new File(Thread.currentThread().getContextClassLoader().getResource("log4j2.json").toURI()));
	final Options options = Mockito.mock(Options.class);
	Mockito.when(options.window()).thenReturn(Mockito.mock(Window.class));
	Mockito.when(mockDriver.manage()).thenReturn(options);
	final WebElement webElement = Mockito.mock(WebElement.class);
	Mockito.when(mockDriver.findElement(ArgumentMatchers.any(By.class))).thenReturn(webElement);
	Mockito.when(webElement.isDisplayed()).thenReturn(true);
	this.driver = mockDriver;
}
 
开发者ID:ligoj,项目名称:bootstrap,代码行数:22,代码来源:TAbstractParallelSeleniumTest.java

示例2: TestMajorCompaction

import org.junit.rules.TestName; //导入依赖的package包/类
/** constructor */
public TestMajorCompaction(String compType) {
  super();
  name = new TestName();
  // Set cache flush size to 1MB
  conf.setInt(HConstants.HREGION_MEMSTORE_FLUSH_SIZE, 1024*1024);
  conf.setInt(HConstants.HREGION_MEMSTORE_BLOCK_MULTIPLIER, 100);
  compactionThreshold = conf.getInt("hbase.hstore.compactionThreshold", 3);
  conf.set(CompactingMemStore.COMPACTING_MEMSTORE_TYPE_KEY, String.valueOf(compType));

  secondRowBytes = START_KEY_BYTES.clone();
  // Increment the least significant character so we get to next row.
  secondRowBytes[START_KEY_BYTES.length - 1]++;
  thirdRowBytes = START_KEY_BYTES.clone();
  thirdRowBytes[START_KEY_BYTES.length - 1] =
      (byte) (thirdRowBytes[START_KEY_BYTES.length - 1] + 2);
}
 
开发者ID:apache,项目名称:hbase,代码行数:18,代码来源:TestMajorCompaction.java

示例3: isWellFormedUserTable

import org.junit.rules.TestName; //导入依赖的package包/类
public static Matcher<? super Result> isWellFormedUserTable(TestName testName) {
  return new BaseMatcher<Result>() {
    @Override
    public boolean matches(Object o) {
      if (o == null) {
        return false;
      }
      Result result = (Result) o;
      HRegionInfo regioninfo;
      try {
        regioninfo = HRegionInfo.parseFrom(result.getValue(HConstants.CATALOG_FAMILY, HConstants.REGIONINFO_QUALIFIER));
      } catch (DeserializationException e) {
        e.printStackTrace();
        return false;
      }
      return regioninfo.getRegionNameAsString().startsWith("c5:" + testName.getMethodName());
    }

    @Override
    public void describeTo(Description description) {

    }
  };
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:25,代码来源:ScanMatchers.java

示例4: BitmapRegressionTester

import org.junit.rules.TestName; //导入依赖的package包/类
public BitmapRegressionTester(Class<?> testClass, TestName testName) {
  this.testClass = testClass;
  this.testName = testName;

  if (testClass.getAnnotation(RegressionTest.class) == null) {
    throw new IllegalArgumentException(
        testClass + " must be annotated with " + RegressionTest.class);
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:BitmapRegressionTester.java

示例5: testParallelIOE

import org.junit.rules.TestName; //导入依赖的package包/类
/**
 * Run sequentially (one instance) the given runnable instance with an exception.
 */
@Test(expected = AssertionError.class)
public void testParallelIOE() {
	testName = Mockito.mock(TestName.class);
	Mockito.when(testName.getMethodName()).thenReturn("mockTestIOE");
	super.runParallel();
}
 
开发者ID:ligoj,项目名称:bootstrap,代码行数:10,代码来源:TAbstractParallelSeleniumTest.java

示例6: testParallelRunningError

import org.junit.rules.TestName; //导入依赖的package包/类
/**
 * Run asynchronously the given runnable instance with an error.
 */
@Test(expected = AssertionError.class)
public void testParallelRunningError() {
	testName = Mockito.mock(TestName.class);
	Mockito.when(testName.getMethodName()).thenThrow(new AssertionFailedError());
	super.runParallel();
}
 
开发者ID:ligoj,项目名称:bootstrap,代码行数:10,代码来源:TAbstractParallelSeleniumTest.java

示例7: testParallelIOE4

import org.junit.rules.TestName; //导入依赖的package包/类
/**
 * Run asynchronously the given runnable instance with an error.
 */
@Test(expected = AssertionError.class)
public void testParallelIOE4() {
	testName = Mockito.mock(TestName.class);
	Mockito.when(testName.getMethodName()).thenReturn("mockTestIOE");
	final DesiredCapabilities mockCapability = Mockito.mock(DesiredCapabilities.class);
	Mockito.when(mockCapability.getBrowserName()).thenThrow(new IllegalStateException());
	repeatedCapabilities = new DesiredCapabilities[] { mockCapability };
	super.runParallel();
}
 
开发者ID:ligoj,项目名称:bootstrap,代码行数:13,代码来源:TAbstractParallelSeleniumTest.java

示例8: testParallelLong

import org.junit.rules.TestName; //导入依赖的package包/类
/**
 * Run asynchronously the given runnable instance with abnormally long run.
 */
@Test(expected = AssertionError.class)
public void testParallelLong() {
	sleep = 0;
	maxRetry = 3;
	testName = Mockito.mock(TestName.class);
	Mockito.when(testName.getMethodName()).thenReturn("mockTestParallelLong");
	super.runParallel();
}
 
开发者ID:ligoj,项目名称:bootstrap,代码行数:12,代码来源:TAbstractParallelSeleniumTest.java

示例9: testSequentialError

import org.junit.rules.TestName; //导入依赖的package包/类
/**
 * Run sequentially (one instance) the given runnable instance with an error.
 */
@Test(expected = AssertionFailedError.class)
public void testSequentialError() {
	testName = Mockito.mock(TestName.class);
	Mockito.when(testName.getMethodName()).thenReturn("mockTestError");
	mockDriver = Mockito.mock(WebDriver.class);
	Mockito.when(mockDriver.manage()).thenThrow(new AssertionFailedError());
	super.runSequential();
}
 
开发者ID:ligoj,项目名称:bootstrap,代码行数:12,代码来源:TAbstractSequentialSeleniumTest.java

示例10: testSequentialError2

import org.junit.rules.TestName; //导入依赖的package包/类
/**
 * Run sequentially the given runnable instance with an error.
 */
@Test(expected = AssertionError.class)
public void testSequentialError2() {
	testName = Mockito.mock(TestName.class);
	Mockito.when(testName.getMethodName()).thenReturn("mockTestError");
	super.runSequential();
}
 
开发者ID:ligoj,项目名称:bootstrap,代码行数:10,代码来源:TAbstractSequentialSeleniumTest.java

示例11: markHits

import org.junit.rules.TestName; //导入依赖的package包/类
public void markHits( TestName testMethodName ) {
    Optional<String> found = bugs.stream().filter( name -> name.equals( testMethodName.getMethodName() ) ).findFirst();

    if( found.isPresent() ) {
        usedBugs.add( found.get() );
        return;
    }

    Optional<String> usedScheme = bugSchemes.stream().filter( scheme -> testMethodName.getMethodName().contains( scheme ) ).findFirst();

    if( usedScheme.isPresent() ) {
        usedSchemes.add( usedScheme.get() );
    }
}
 
开发者ID:openCage,项目名称:niotest,代码行数:15,代码来源:FSDescription.java

示例12: getTimeoutRule

import org.junit.rules.TestName; //导入依赖的package包/类
public static TestRule getTimeoutRule(int timeout) {
  return IS_DEBUG ? new TestName() : new Timeout(timeout);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:4,代码来源:TestTools.java

示例13: getRepeatRule

import org.junit.rules.TestName; //导入依赖的package包/类
/**
 * If not enforced, the repeat rule applies only if the test is run in non-debug mode.
 */
public static TestRule getRepeatRule(final boolean enforce) {
  return enforce || !IS_DEBUG ? new RepeatTestRule() : new TestName();
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:7,代码来源:TestTools.java

示例14: SerializationProxy

import org.junit.rules.TestName; //导入依赖的package包/类
SerializationProxy(final SerializableTestName instance) {
  this.name = (String) readField(TestName.class, instance, FIELD_NAME);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:4,代码来源:SerializableTestName.java

示例15: readResolve

import org.junit.rules.TestName; //导入依赖的package包/类
private Object readResolve() {
  SerializableTestName instance = new SerializableTestName();
  writeField(TestName.class, instance, FIELD_NAME, this.name);
  return instance;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:6,代码来源:SerializableTestName.java


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