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