當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。