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


Java When类代码示例

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


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

示例1: replace

import cucumber.api.java.en.When; //导入依赖的package包/类
@When("^replace (\\w+)$")
public void replace(String name, DataTable table) {
    name = name.trim();
    String text = getVarAsString(name);
    List<Map<String, String>> list = table.asMaps(String.class, String.class);
    String replaced = Script.replacePlaceholders(text, list, context);
    context.vars.put(name, replaced);
}
 
开发者ID:intuit,项目名称:karate,代码行数:9,代码来源:StepDefs.java

示例2: sendMalformedLldpPacket

import cucumber.api.java.en.When; //导入依赖的package包/类
@When("^send malformed lldp packet$")
public void sendMalformedLldpPacket() throws Throwable {
        System.out.println("=====> Send malformed packet");

        long current = System.currentTimeMillis();
        Client client = ClientBuilder.newClient(new ClientConfig());
        Response result = client
                .target(trafficEndpoint)
                .path("/send_malformed_packet")
                .request()
                .post(null);
        System.out.println(String.format("======> Response = %s", result.toString()));
        System.out.println(String.format("======> Send malformed packet Time: %,.3f", getTimeDuration(current)));

    assertEquals(200, result.getStatus());

}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:18,代码来源:TopologyDiscoveryBasicTest.java

示例3: on

import cucumber.api.java.en.When; //导入依赖的package包/类
@When("^client_one does a PUT on (.*?) with (.*?) in zone 1$")
public void client_one_does_a_PUT_on_identifier_in_test_zone(final String api, final String identifier)
        throws Throwable {
    OAuth2RestTemplate acsTemplate = this.acsZone1Template;
    try {
        switch (api) {
        case "subject":
            this.privilegeHelper.putSubject(acsTemplate, this.subject, this.acsUrl, this.zone1Headers,
                    this.privilegeHelper.getDefaultAttribute());
            break;
        case "resource":
            this.privilegeHelper.putResource(acsTemplate, this.resource, this.acsUrl, this.zone1Headers,
                    this.privilegeHelper.getDefaultAttribute());
            break;
        case "policy-set":
            this.testPolicyName = "single-action-defined-policy-set";
            this.policyHelper.createPolicySet("src/test/resources/single-action-defined-policy-set.json",
                    acsTemplate, this.zone1Headers);
            break;
        default:
            Assert.fail("Api " + api + " does not match/is not yet implemented for this test code.");
        }
    } catch (HttpClientErrorException e) {
        Assert.fail("Unable to PUT identifier: " + identifier + " for api: " + api);
    }
}
 
开发者ID:eclipse,项目名称:keti,代码行数:27,代码来源:ZoneEnforcementStepsDefinitions.java

示例4: isValidBidRequest

import cucumber.api.java.en.When; //导入依赖的package包/类
@When("^an openRtb validator version \"([^\"]*)\" runs validation on given bid request$")
public void isValidBidRequest(String version) throws Throwable {
	getVersion(version);
	System.out.println("version"+version);
	System.out.println(openRtbVersion);
	validator = OpenRtbValidatorFactory.getValidator(OpenRtbInputType.BID_REQUEST, openRtbVersion);
	result = validator.validate(JsonLoader.fromResource(resource));
	logger.info("validation result: " + result);
}
 
开发者ID:ad-tech-group,项目名称:openssp,代码行数:10,代码来源:OpenRtb2_4BidRequestResponseSteps.java

示例5: having

import cucumber.api.java.en.When; //导入依赖的package包/类
@When("^I click on element having (id|name|class|xpath|css) \"([^\"]*)\" and text \"([^\"]*)\"$")
public void clickElementHaving(String type, String element, String text) {
	List<WebElement> webElements = getWebElements(type, element);
       for (WebElement el : webElements)
           if (text.trim().equals(el.getText().trim()))
               click(el);
   }
 
开发者ID:entelgy-brasil,项目名称:zucchini,代码行数:8,代码来源:ClickStep.java

示例6: iPOSTItToTheTemplatesEndpoint

import cucumber.api.java.en.When; //导入依赖的package包/类
@When("^I POST it to the /templates endpoint$")
public void iPOSTItToTheTemplatesEndpoint() throws Throwable {
    try {
        lastApiResponse = api.createTemplateWithHttpInfo(template);
        lastApiCallThrewException = false;
        lastApiException = null;
        lastStatusCode = lastApiResponse.getStatusCode();
    } catch (ApiException e) {
        lastApiCallThrewException = true;
        lastApiResponse = null;
        lastApiException = e;
        lastStatusCode = lastApiException.getCode();
    }
}
 
开发者ID:PestaKit,项目名称:microservice-email,代码行数:15,代码来源:TemplatesSteps.java

示例7: logOutOfJHipsterSampleApp

import cucumber.api.java.en.When; //导入依赖的package包/类
/**
 * Logout of JHipsterSampleApp.
 *
 * @throws FailureException
 *             if the scenario encounters a functional error.
 * @throws TechnicalException
 *             is thrown if you have a technical error (format, configuration, datas, ...) in NoraUi.
 */
@When("I log out of JHIPSTERSAMPLEAPP")
public void logOutOfJHipsterSampleApp() throws FailureException, TechnicalException {
    if (Auth.isConnected()) {
        getDriver().switchTo().defaultContent();
        clickOn(jHipsterSampleAppPage.accountMenu);
        Context.waitUntil(ExpectedConditions.presenceOfElementLocated(Utilities.getLocator(jHipsterSampleAppPage.signoutMenu))).click();
    }
}
 
开发者ID:NoraUi,项目名称:noraui-academy,代码行数:17,代码来源:JHipsterSampleAppSteps.java

示例8: jennyDeletesAnImage

import cucumber.api.java.en.When; //导入依赖的package包/类
@When("^Jenny deletes an image$")
public void jennyDeletesAnImage() throws Throwable {
    String userAuthorization = "Basic " + Base64.getEncoder().encodeToString(("user" + ":" + "default").getBytes());
    response = mockMvc.perform(get("http://localhost:8080/imageClassifier/deleteImage")
            .header("Authorization", userAuthorization)
            .param("email", "[email protected]")
            .param("fileName", "ChihuahuaOrMuffin")
            .accept(MediaType.APPLICATION_JSON));
}
 
开发者ID:KobePig,项目名称:NutriBuddi,代码行数:10,代码来源:ImageStepsDelete.java

示例9: whenICreateANewPublication

import cucumber.api.java.en.When; //导入依赖的package包/类
@When("^I create a new publication$")
public void whenICreateANewPublication() throws Throwable {
    final Publication publication = TestDataFactory.createValidPublication().build();
    testDataRepo.setPublication(publication);

    assertThat("New publication created.", contentPage.newPublication(publication), is(true));
}
 
开发者ID:NHS-digital-website,项目名称:hippo,代码行数:8,代码来源:CmsSteps.java

示例10: a_link_is_added_in_the_middle

import cucumber.api.java.en.When; //导入依赖的package包/类
@When("^a link is added in the middle$")
public void a_link_is_added_in_the_middle() throws Exception {
    List<IslInfoData> links = LinksUtils.dumpLinks();
    IslInfoData middleLink = getMiddleLink(links);

    String srcSwitch = getSwitchName(middleLink.getPath().get(0).getSwitchId());
    String dstSwitch = getSwitchName(middleLink.getPath().get(1).getSwitchId());
    assertTrue("Link is not added", LinksUtils.addLink(srcSwitch, dstSwitch));
    TimeUnit.SECONDS.sleep(2);
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:11,代码来源:TopologyEventsBasicTest.java

示例11: with

import cucumber.api.java.en.When; //导入依赖的package包/类
@When("^flow (.*) creation request with (.*) (\\d+) (\\d+) and (.*) (\\d+) (\\d+) and (\\d+) is successful$")
public void successfulFlowCreation(final String flowId, final String sourceSwitch, final int sourcePort,
                                   final int sourceVlan, final String destinationSwitch, final int destinationPort,
                                   final int destinationVlan, final int bandwidth) throws Exception {
    flowPayload = new FlowPayload(FlowUtils.getFlowName(flowId),
            new FlowEndpointPayload(sourceSwitch, sourcePort, sourceVlan),
            new FlowEndpointPayload(destinationSwitch, destinationPort, destinationVlan),
            bandwidth, flowId, null);

    FlowPayload response = FlowUtils.putFlow(flowPayload);
    assertNotNull(response);
    response.setLastUpdated(null);

    assertEquals(flowPayload, response);
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:16,代码来源:FlowCrudBasicRunTest.java

示例12: sheOrdersA

import cucumber.api.java.en.When; //导入依赖的package包/类
@When("^(?:.*) (?:orders|has ordered) an? (.*)$")
public void sheOrdersA(String order) throws Throwable {
    orderReceipt = customer.placesAnOrderFor(1, order);

    Serenity.setSessionVariable("orderReceipt").to(orderReceipt);
}
 
开发者ID:serenity-dojo,项目名称:caffeinate-me,代码行数:7,代码来源:OrderACoffeeStepDefinitions.java

示例13: importDetails

import cucumber.api.java.en.When; //导入依赖的package包/类
@When("^she see details about imported extension$")
public void importDetails() throws Throwable {
	//TODO Deeper validation
	assertThat(techExtensionsImportPage.validate(), is(true));
	
	techExtensionsImportPage.getButton("Import Extension").shouldBe(visible);
	techExtensionsImportPage.getButton("Cancel").shouldBe(visible);
}
 
开发者ID:syndesisio,项目名称:syndesis-qe,代码行数:9,代码来源:TechnicalExtensionSteps.java

示例14: sheMakesARequestToUsergoalDeleteUserGoal

import cucumber.api.java.en.When; //导入依赖的package包/类
@When("^she makes a request to usergoal/addUserGoal$")
public void sheMakesARequestToUsergoalDeleteUserGoal() throws Throwable {
    String userAuthorization = "Basic " + Base64.getEncoder().encodeToString(("user" + ":" + "default").getBytes());
    response = mockMvc.perform(get("http://localhost:8080/userGoal/deleteUserGoal")
            .header("Authorization", userAuthorization)
            .param("email", "[email protected]")
            .accept(MediaType.APPLICATION_JSON));
}
 
开发者ID:KobePig,项目名称:NutriBuddi,代码行数:9,代码来源:UserGoalStepsAdd.java

示例15: selectPointsForMetricWithTagBetweenAnd

import cucumber.api.java.en.When; //导入依赖的package包/类
@When("^select points for metric \"([^\"]*)\" with tag \"([^\"]*)\" = \"([^\"]*)\" between \"([^\"]*)\" and \"([^\"]*)\"$")
public void selectPointsForMetricWithTagBetweenAnd(String metricName, String tagName, String tagValue, String fromTimeString, String toTimeString) throws Throwable {
    Tag tag = Tag.of(tagName, tagValue);
    Interval interval = Interval.until(parseTime(toTimeString)).from(parseTime(fromTimeString));
    actualMetricsPoints = granularity == null
                          ? pugTSDB.selectMetricsPoints(metricName, interval, tag)
                          : pugTSDB.selectMetricsPoints(metricName, granularity, interval, tag);
}
 
开发者ID:StefaniniInspiring,项目名称:pugtsdb,代码行数:9,代码来源:SelectionSteps.java


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