本文整理汇总了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;
}
示例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);
}
示例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) {
}
};
}
示例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);
}
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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() );
}
}
示例12: getTimeoutRule
import org.junit.rules.TestName; //导入依赖的package包/类
public static TestRule getTimeoutRule(int timeout) {
return IS_DEBUG ? new TestName() : new Timeout(timeout);
}
示例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();
}
示例14: SerializationProxy
import org.junit.rules.TestName; //导入依赖的package包/类
SerializationProxy(final SerializableTestName instance) {
this.name = (String) readField(TestName.class, instance, FIELD_NAME);
}
示例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;
}