Java 类org.junit.rules.TestWatcher 实例源码

项目:glowroot    文件:WebDriverSetup.java   
public TestWatcher getSauceLabsTestWatcher() {
    if (!SauceLabs.useSauceLabs()) {
        return new TestWatcher() {};
    }
    String sauceUsername = System.getenv("SAUCE_USERNAME");
    String sauceAccessKey = System.getenv("SAUCE_ACCESS_KEY");
    SauceOnDemandAuthentication authentication =
            new SauceOnDemandAuthentication(sauceUsername, sauceAccessKey);
    SauceOnDemandSessionIdProvider sessionIdProvider = new SauceOnDemandSessionIdProvider() {
        @Override
        public String getSessionId() {
            return remoteWebDriverSessionId;
        }
    };
    return new SauceOnDemandTestWatcher(sessionIdProvider, authentication);
}
项目:Selenium-Foundation    文件:DriverWatcher.java   
/**
 * Get test watcher to manage driver instances.
 * 
 * @param obj test class instance extending {@link TestBase}
 * @return test watcher object
 */
public static TestWatcher getTestWatcher(final TestBase obj) {
    return new TestWatcher() {
        @Override
        protected void finished(Description description) {
            DriverManager.closeDriver(obj);
        }
    };
}
项目:january    文件:Utils.java   
/**
 * This function create a TestWatcher writing on screen the names of called
 * classes and methods.
 * 
 * @return the TestWatcher created
 */
public static TestWatcher testWatcherCreator() {
    return new TestWatcher() {
        protected void starting(Description description) {
            System.out.println("\nStarting example : " + description.getMethodName() + " from : "
                    + description.getClassName() + " class.");
        }
    };
}
项目:aeron    文件:TestUtil.java   
public static TestWatcher newWatcher(final Class clazz, final long seed)
{
    return new TestWatcher()
    {
        protected void failed(final Throwable t, final Description description)
        {
            System.err.println(clazz.getName() + " failed with random seed: " + seed);
        }
    };
}
项目:jenkins-build-monitor-plugin    文件:FindFreePort.java   
@Override
public TestRule applyTo(final JenkinsInstance instance) {
    return new TestWatcher() {
        @Override
        protected void starting(Description description) {
            int portNumber = anyFreeLocalPortInRange(rangeStart, rangeEnd);

            Log.info("Found a free port: {}", portNumber);

            instance.setPort(portNumber);
        }
    };
}
项目:jenkins-build-monitor-plugin    文件:SandboxJenkinsHome.java   
@Override
public TestRule applyTo(final JenkinsInstance jenkins) {
    return new TestWatcher() {
        @Override
        protected void starting(Description test) {

            Path jenkinsHome = temporaryJenkinsHomeFor(test);

            Log.info("Setting jenkins home to {}", jenkinsHome);

            jenkins.setHome(jenkinsHome);
        }
    };
}
项目:jenkins-build-monitor-plugin    文件:RegisterUserAccount.java   
@Override
public TestRule applyTo(final JenkinsInstance jenkins) {
    return new TestWatcher() {
        @Override
        protected void starting(Description description) {
            jenkins.client().registerAccount(user.getName(), user.password());
        }
    };
}
项目:jenkins-build-monitor-plugin    文件:InstallPluginsFromUpdateCenter.java   
@Override
public TestRule applyTo(final JenkinsInstance jenkins) {
    return new TestWatcher() {
        @Override protected void starting(Description description) {

            warmUpUpdateCenterCacheFor(jenkins);

            jenkins.client().installPlugins(requiredPlugins);
        }
    };
}
项目:monarch    文件:SerializableTestWatcherTest.java   
@Test
public void hasZeroFields() throws Exception {
  Field[] fields = TestWatcher.class.getDeclaredFields();
  assertThat(fields.length).as("Fields: " + Arrays.asList(fields)).isEqualTo(0);
}
项目:glowroot    文件:WebDriverIT.java   
@Rule
public TestWatcher getSauceLabsTestWatcher() {
    return setup.getSauceLabsTestWatcher();
}
项目:camunda-bpm-needle    文件:ProcessEngineTestWatcher.java   
@Override
protected TestWatcher innerRule() {
  return innerRule;
}
项目:AppCenter-Test-Appium-Java-Extensions    文件:Factory.java   
/**
 * Create watcher for JUnit
 * @return a watcher for use with JUnit
 */
public static TestWatcher createWatcher() {
    return provider.createWatcher();
}
项目:test-cloud-appium-java-extensions    文件:Factory.java   
/**
 * Create watcher for JUnit
 * @return a watcher for use with JUnit
 */
public static TestWatcher createWatcher() {
    return provider.createWatcher();
}