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