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


Java RuleChain类代码示例

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


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

示例1: DropwizardAppWithPostgresRule

import org.junit.rules.RuleChain; //导入依赖的package包/类
public DropwizardAppWithPostgresRule(String configPath, ConfigOverride... configOverrides) {
    configFilePath = resourceFilePath(configPath);
    postgres = new PostgresDockerRule();
    List<ConfigOverride> cfgOverrideList = newArrayList(configOverrides);
    cfgOverrideList.add(config("database.url", postgres.getConnectionUrl()));
    cfgOverrideList.add(config("database.user", postgres.getUsername()));
    cfgOverrideList.add(config("database.password", postgres.getPassword()));

    app = new DropwizardAppRule<>(
            AdminUsersApp.class,
            configFilePath,
            cfgOverrideList.toArray(new ConfigOverride[cfgOverrideList.size()])
    );
    createJpaModule(postgres);
    rules = RuleChain.outerRule(postgres).around(app);
    registerShutdownHook();
}
 
开发者ID:alphagov,项目名称:pay-adminusers,代码行数:18,代码来源:DropwizardAppWithPostgresRule.java

示例2: ExpectedDeploymentException

import org.junit.rules.RuleChain; //导入依赖的package包/类
private ExpectedDeploymentException() {
    chain = RuleChain
        .outerRule(log)
        .around((base, description) -> new Statement() {
            @Override
            public void evaluate() throws Throwable {
                try {
                    base.evaluate();
                } catch (Throwable exception) {
                    assertThat(exception, allOf(pecs(exceptions)));
                    try {
                        // OpenWebBeans logs the deployment exception details
                        // TODO: OpenWebBeans only log the root cause of exception thrown in producer methods
                        //assertThat(log.getMessages(), containsInRelativeOrder(pecs(messages)))
                        assertThat(log.getMessages(), anyOf(hasItems(messages)));
                    } catch (AssertionError error) {
                        // Weld stores the deployment exception details in the exception message
                        assertThat(exception.getMessage(), allOf(pecs(messages)));
                    }
                }
            }
        });
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:24,代码来源:ExpectedDeploymentException.java

示例3: executionStatement

import org.junit.rules.RuleChain; //导入依赖的package包/类
private Statement executionStatement(final RunNotifier notifier, final int minPriority, final RuleChain ruleChain) {
    return new Statement() {
        @Override
        public void evaluate() {
            RuleChain ongoingRuleChain = withRules(ruleChain, specificationNode.rules());
            if (hasOwnTest(minPriority)) {
                evaluateStatementAndNotifyFailures(
                    ongoingRuleChain,
                    specificationNode.test().get().asStatement(),
                    notifier);
            }
            for(ExecutableNode child : children) {
                child.execute(notifier, minPriority, ongoingRuleChain);
            }
        }
    };
}
 
开发者ID:hgcummings,项目名称:jarspec,代码行数:18,代码来源:ExecutableNode.java

示例4: ExpectedDeploymentException

import org.junit.rules.RuleChain; //导入依赖的package包/类
private ExpectedDeploymentException() {
    chain = RuleChain
        .outerRule(log)
        .around((base, description) -> new Statement() {
            @Override
            public void evaluate() {
                try {
                    base.evaluate();
                } catch (Throwable exception) {
                    assertThat(exception, allOf(pecs(exceptions)));
                    try {
                        // OpenWebBeans logs the deployment exception details
                        // TODO: OpenWebBeans only log the root cause of exception thrown in producer methods
                        //assertThat(log.getMessages(), containsInRelativeOrder(pecs(messages)))
                        assertThat(log.getMessages(), anyOf(hasItems(messages)));
                    } catch (AssertionError error) {
                        // Weld stores the deployment exception details in the exception message
                        assertThat(exception.getMessage(), allOf(pecs(messages)));
                    }
                }
            }
        });
}
 
开发者ID:astefanutti,项目名称:camel-cdi,代码行数:24,代码来源:ExpectedDeploymentException.java

示例5: createTestRule

import org.junit.rules.RuleChain; //导入依赖的package包/类
public TestRule createTestRule() {
  final TemporaryFolder tempFolder = new TemporaryFolder();

  return RuleChain
    .outerRule(tempFolder)
    .around(new ExternalResource() {

      TomcatServerBootstrap bootstrap = new JerseyTomcatServerBootstrap(webXmlResource);

      protected void before() throws Throwable {
        bootstrap.setWorkingDir(tempFolder.getRoot().getAbsolutePath());
        bootstrap.start();
      }

      protected void after() {
        bootstrap.stop();
      }
    });
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:20,代码来源:JerseySpecifics.java

示例6: createTestRule

import org.junit.rules.RuleChain; //导入依赖的package包/类
public TestRule createTestRule() {
  final TemporaryFolder tempFolder = new TemporaryFolder();

  return RuleChain
    .outerRule(tempFolder)
    .around(new ExternalResource() {

      WinkTomcatServerBootstrap bootstrap = new WinkTomcatServerBootstrap(webXmlResource);

      protected void before() throws Throwable {
        bootstrap.setWorkingDir(tempFolder.getRoot().getAbsolutePath());
        bootstrap.start();
      }

      protected void after() {
        bootstrap.stop();
      }
    });
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:20,代码来源:WinkSpecifics.java

示例7: createTestRule

import org.junit.rules.RuleChain; //导入依赖的package包/类
public TestRule createTestRule() {
  final TemporaryFolder tempFolder = new TemporaryFolder();

  return RuleChain
    .outerRule(tempFolder)
    .around(new ExternalResource() {

      TomcatServerBootstrap bootstrap = new CXFTomcatServerBootstrap(webXmlResource);

      protected void before() throws Throwable {
        bootstrap.setWorkingDir(tempFolder.getRoot().getAbsolutePath());
        bootstrap.start();
      }

      protected void after() {
        bootstrap.stop();
      }
    });
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:20,代码来源:CXFSpecifics.java

示例8: createTestRule

import org.junit.rules.RuleChain; //导入依赖的package包/类
public TestRule createTestRule() {
  final TemporaryFolder tempFolder = new TemporaryFolder();

  return RuleChain
    .outerRule(tempFolder)
    .around(new ExternalResource() {

      ResteasyTomcatServerBootstrap bootstrap = new ResteasyTomcatServerBootstrap(webXmlResource);

      protected void before() throws Throwable {
        bootstrap.setWorkingDir(tempFolder.getRoot().getAbsolutePath());
        bootstrap.start();
      }

      protected void after() {
        bootstrap.stop();
      }
    });
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:20,代码来源:ResteasySpecifics.java

示例9: setupRuleChain

import org.junit.rules.RuleChain; //导入依赖的package包/类
/**
 * Sets up both users and the RuleChain.
 * 
 * @return RuleChain
 */
private static RuleChain setupRuleChain()
{
    BRITISH_USER = new AlfrescoPerson(APP_CONTEXT_INIT, "[email protected]");
    FRENCH_USER = new AlfrescoPerson(APP_CONTEXT_INIT, "[email protected]");
    AUSTRALIAN_USER = new AlfrescoPerson(APP_CONTEXT_INIT, "[email protected]");
    EXTERNAL_USER = new AlfrescoPerson(APP_CONTEXT_INIT, "[email protected]");

    return RuleChain.outerRule(APP_CONTEXT_INIT).around(AUSTRALIAN_USER).around(BRITISH_USER).around(FRENCH_USER).around(EXTERNAL_USER);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:15,代码来源:MailActionExecuterTest.java

示例10: getAllResourcesRule

import org.junit.rules.RuleChain; //导入依赖的package包/类
public static RuleChain getAllResourcesRule(int timeout) {
    if (allResourcesRule == null) {
        allResourcesRule = RuleChain
            .outerRule(new Timeout(timeout))
            .around(CLUSTER_RESOURCE);
    }
    return allResourcesRule;
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:9,代码来源:SingleClusterResource.java

示例11: getAllResourcesRule

import org.junit.rules.RuleChain; //导入依赖的package包/类
public static RuleChain getAllResourcesRule(int timeout) {
    if (allResourcesRule == null) {
        allResourcesRule = RuleChain
            .outerRule(FOLDER)
            .around(new Timeout(timeout))
            .around(new EmbeddedKafkaRule(FOLDER, "mainKafka", 3, 2181, 9092))
            .around(new EmbeddedKafkaRule(FOLDER, "drKafka", 3, 2182, 9096))
            .around(SUPER_CLUSTER_RESOURCE)
            .around(MAIN_CLUSTER_RESOURCE)
            .around(DR_CLUSTER_RESOURCE);
    }
    return allResourcesRule;
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:14,代码来源:FullClusterTestResourcesFactory.java

示例12: SeleniumRule

import org.junit.rules.RuleChain; //导入依赖的package包/类
/**
 * @param parameterObjects objects wich can be injected into {@link SeleniumProvider} implementations.
 *                         See {@link SeleniumProviderFactory}
 */
public SeleniumRule(ParameterObject... parameterObjects) {
    ParameterObject[] allParameterObjects =
            ArrayUtils.addAll(parameterObjects, new ParameterObject(firefoxConfiguration.getClass(), firefoxConfiguration));

    defaultSeleniumProvider = SeleniumProviderFactory.createSeleniumProviderRule(allParameterObjects);
    defaultSeleniumProvider.addWebDriverConfigurationParticipant(new FileDetectorConfigurator<>());
    defaultSeleniumProvider.addWebDriverConfigurationParticipant(timeoutsConfigurationParticipant);

    DefaultFirefoxConfigurationParticipant<D> defaultFirefoxConfigurationParticipant =
            new DefaultFirefoxConfigurationParticipant<>();
    defaultSeleniumProvider.addWebDriverConfigurationParticipant(defaultFirefoxConfigurationParticipant);
    firefoxConfiguration.addFirefoxConfigurationParticipant(defaultFirefoxConfigurationParticipant);

    JavascriptError<P, D> javascriptErrorRule =
            new JavascriptError<>(defaultSeleniumProvider, false);
    firefoxConfiguration.addFirefoxConfigurationParticipant(javascriptErrorRule);
    WebDriverLog<P, D> webDriverLog = new WebDriverLog<>(defaultSeleniumProvider);
    PageSource pageSource = new PageSource(defaultSeleniumProvider);
    screenshotRule = new ScreenshotRule(defaultSeleniumProvider)
            .setScreenshotProvider(new DefaultScreenshotProvider());
    JavascriptAlert javascriptAlert = new JavascriptAlert(defaultSeleniumProvider);

    ruleChain = RuleChain
            .outerRule(defaultSeleniumProvider)
            .around(webDriverLog)
            .around(pageSource)
            .around(screenshotRule)
            .around(javascriptAlert)
            .around(javascriptErrorRule)
            .around(resourceHelper);
}
 
开发者ID:willhaben,项目名称:willtest,代码行数:36,代码来源:SeleniumRule.java

示例13: apply

import org.junit.rules.RuleChain; //导入依赖的package包/类
@Override
public Statement apply(Statement base, Description description) {
    return RuleChain
            .outerRule(logContext)
            .around(ruleChain)
            .apply(base,description);
}
 
开发者ID:willhaben,项目名称:willtest,代码行数:8,代码来源:SeleniumRule.java

示例14: RegisterRule

import org.junit.rules.RuleChain; //导入依赖的package包/类
public RegisterRule() {
    this.appRule = new DropwizardAppRule<>(RegisterApplication.class,
            ResourceHelpers.resourceFilePath("test-app-config.yaml"));
    wipeRule = new WipeDatabaseRule(TestRegister.values());
    wholeRule = RuleChain
            .outerRule(appRule)
            .around(wipeRule);
}
 
开发者ID:openregister,项目名称:openregister-java,代码行数:9,代码来源:RegisterRule.java

示例15: rules

import org.junit.rules.RuleChain; //导入依赖的package包/类
public TestRule rules() {
    if (System.getProperty(ACCTEST_BASEURI_PROPERTY) == null) {
        return RuleChain
                .outerRule(databaseContext.rules())
                .around(appRule);
    } else {
        return new TestRule() {
            @Override
            public Statement apply(final Statement base, final Description description) {
                return base;
            }
        };
    }
}
 
开发者ID:lewisd32,项目名称:authrite,代码行数:15,代码来源:SystemDriver.java


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