本文整理汇总了Java中cucumber.api.DataTable类的典型用法代码示例。如果您正苦于以下问题:Java DataTable类的具体用法?Java DataTable怎么用?Java DataTable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DataTable类属于cucumber.api包,在下文中一共展示了DataTable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: he_has_added_the_following_reporters
import cucumber.api.DataTable; //导入依赖的package包/类
@Given("^he has added the following match-reporters:$")
public void he_has_added_the_following_reporters(DataTable reporterDefTable) throws Throwable {
List<Reporter> reps = new ArrayList<>();
for (Map<String,String> repDef:reporterDefTable.asMaps(String.class, String.class)) {
Reporter rep = new Reporter();
rep.setName(repDef.get("name"));
rep.setFileName(repDef.get("fileName"));
rep.setPackageName(repDef.get("packageName"));
rep.setClassName(repDef.get("className"));
rep.setParams(repDef.get("params"));
rep.setConfig(this.config);
rep.persist();
reps.add(rep);
}
config.setReporters(reps);
}
示例2: I_expect_to_see_movie_posters
import cucumber.api.DataTable; //导入依赖的package包/类
@When("^I expect to see the following movie posters$")
public void I_expect_to_see_movie_posters(final DataTable dataTable) {
for (Map<String, String> row : dataTable.asMaps(String.class, String.class)) {
int position = Integer.valueOf(row.get("position"));
String posterPath = row.get("posterPath");
popularMoviesRobot.checkPosterWithPathIsDisplayedAtPosition(position, posterPath);
}
}
示例3: setJmsSubscribeData
import cucumber.api.DataTable; //导入依赖的package包/类
@And("^sets jms subscribe inputs source data$")
public void setJmsSubscribeData(DataTable sourceMappingData) {
for (Map<String, String> source : sourceMappingData.asMaps(String.class, String.class)) {
for (String field : source.keySet()) {
SelenideElement element = editPage.getJmsSubscribeComponent().checkAndGetFieldType(field);
assertThat(element, notNullValue());
editPage.getJmsSubscribeComponent().setElementValue(source.get(field), element);
}
}
}
示例4: verifyListRowData
import cucumber.api.DataTable; //导入依赖的package包/类
@Then("^(?:I should see |)the (first|last) (?:row|item) of the \"(.*)\" (?:list|table) contains the following data:$")
public void verifyListRowData(String firstLast, String list, DataTable data) throws Throwable {
int index = 0;
TableView control = (TableView) verifyElementExists(list);
if (firstLast.equals("last")) {
index = control.getItemsCount() - 1;
}
List<Map<String, String>> content = data.asMaps(String.class,
String.class);
for (Map<String, String> row : content) {
for (Entry<String, String> entry : row.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
Assert.assertEquals(String.format("The %s row element '%s' has unexpected value", firstLast, key),
value, control.getSubItem(key, index).getText());
}
}
}
示例5: he_has_added_a_matcher_for_the_second_column
import cucumber.api.DataTable; //导入依赖的package包/类
@Given("^he has added a matcher for the second column:$")
public void he_has_added_a_matcher_for_the_second_column(DataTable matcherDefTable) throws Throwable {
List<Map<String,String>> matcherDef = matcherDefTable.asMaps(String.class, String.class);
matcher = new Matcher();
matcher.setName(matcherDef.get(0).get("name"));
matcher.setPackageName(matcherDef.get(0).get("packageName"));
matcher.setClassName(matcherDef.get(0).get("className"));
matcher.setParams(matcherDef.get(0).get("params"));
matcher.setConfiguration(config);
matcher.persist();
List<Matcher> matchers = new ArrayList<>();
matchers.add(matcher);
config.getMatchers().add(matcher);
config.setVersion(config.getVersion() + 1);
assert (Matcher.findMatcher(this.matcher.getId()) != null);
}
示例6: he_has_added_two_matchers
import cucumber.api.DataTable; //导入依赖的package包/类
@Given("^he has added two matchers:$")
public void he_has_added_two_matchers(DataTable matcherDefTable) throws Throwable {
for (Map<String,String> matcherDef:matcherDefTable.asMaps(String.class, String.class)) {
Matcher matcher = new Matcher();
matcher.setName(matcherDef.get("name"));
matcher.setPackageName(matcherDef.get("packageName"));
matcher.setClassName(matcherDef.get("className"));
matcher.setParams(matcherDef.get("params"));
matcher.setConfiguration(config);
matcher.persist();
matchers.put(matcher.getName(), matcher);
config.getMatchers().add(matcher);
config.setVersion(config.getVersion() + 1);
assert (Matcher.findMatcher(matcher.getId()) != null);
}
}
示例7: he_has_added_the_following_reporters
import cucumber.api.DataTable; //导入依赖的package包/类
@Given("^he has added the following reporters:$")
public void he_has_added_the_following_reporters(DataTable reporterDefTable) throws Throwable {
List<Reporter> reps = new ArrayList<>();
for (Map<String,String> repDef:reporterDefTable.asMaps(String.class, String.class)) {
Reporter rep = new Reporter();
rep.setName(repDef.get("name"));
rep.setFileName(repDef.get("fileName"));
rep.setPackageName(repDef.get("packageName"));
rep.setClassName(repDef.get("className"));
rep.setParams(repDef.get("params"));
rep.setConfig(this.config);
rep.persist();
reps.add(rep);
}
config.setReporters(reps);
}
示例8: setJmsRequestData
import cucumber.api.DataTable; //导入依赖的package包/类
@And("^sets jms request inputs source data$")
public void setJmsRequestData(DataTable sourceMappingData) {
for (Map<String, String> source : sourceMappingData.asMaps(String.class, String.class)) {
for (String field : source.keySet()) {
SelenideElement element = editPage.getJmsSubscribeComponent().checkAndGetFieldType(field);
assertThat(element, notNullValue());
editPage.getJmsSubscribeComponent().setElementValue(source.get(field), element);
}
}
}
示例9: setJmsPublishData
import cucumber.api.DataTable; //导入依赖的package包/类
@And("^sets jms publish inputs source data$")
public void setJmsPublishData(DataTable sourceMappingData) {
for (Map<String, String> source : sourceMappingData.asMaps(String.class, String.class)) {
for (String field : source.keySet()) {
SelenideElement element = editPage.getJmsPublishComponent().checkAndGetFieldType(field);
assertThat(element, notNullValue());
editPage.getJmsPublishComponent().setElementValue(source.get(field), element);
}
}
}
示例10: replace
import cucumber.api.DataTable; //导入依赖的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);
}
示例11: should
import cucumber.api.DataTable; //导入依赖的package包/类
@Then("^I should(?: also)? see multiple \"([^\"]+)\" with:")
public void iShouldSeeMultipleItemsOf(String pageElementName, final DataTable elementItems) throws Throwable {
int i = 0;
for (List<String> elementItem : elementItems.raw()) {
WebElement pageElement = sitePage.findPageElement(pageElementName, i++);
assertThat("I should find page element: " + pageElementName,
pageElement, is(notNullValue()));
String expectedItemText = elementItem.get(0);
assertThat("Page element " + pageElementName + " contain item with text: " + expectedItemText,
getElementText(pageElement),
getMatcherForText(expectedItemText));
}
}
示例12: getMatcherForQualifier
import cucumber.api.DataTable; //导入依赖的package包/类
private Matcher<Iterable<String>> getMatcherForQualifier(String qualifier, DataTable listItems) {
Stream<Matcher<String>> matcherStream = listItems.asList(String.class).stream()
.map(SiteSteps::getMatcherForText);
switch (qualifier) {
case "containing": return (Matcher)contains(matcherStream.collect(toList()));
case "including": return hasItems(matcherStream.toArray(Matcher[]::new));
case "not including":
return not(
anyOf(
matcherStream
.map(Matchers::hasItem)
.collect(toList())
)
);
default: throw new RuntimeException("Unknown qualifier: " + qualifier);
}
}
示例13: populatePageWithData
import cucumber.api.DataTable; //导入依赖的package包/类
@When("^(?:I |)populate current page with the following data:$")
public void populatePageWithData(DataTable data) throws Throwable {
List<Map<String, String>> content = data.asMaps(String.class,
String.class);
for (Map<String, String> row : content) {
enterValue(row.get("Value"), row.get("Field"));
}
}
示例14: pageContainsData
import cucumber.api.DataTable; //导入依赖的package包/类
@Then("^(?:I should see |)the page contains the following data:$")
public void pageContainsData(DataTable data) throws Throwable {
List<Map<String, String>> content = data.asMaps(String.class,
String.class);
for (Map<String, String> row : content) {
verifyFieldText(row.get("Field"), row.get("Value"));
}
}
示例15: extractPostersFromDataTable
import cucumber.api.DataTable; //导入依赖的package包/类
private void extractPostersFromDataTable(DataTable dataTable) {
ConfigurableBackend configurableBackend = getConfigurableBackend();
for (final Map<String, String> row : dataTable.asMaps(String.class, String.class)) {
Long movieId = Long.valueOf(row.get("movieId"));
String posterPath = row.get("posterPath");
configurableBackend.addToPopularStream(createApiMoviePoster(movieId, posterPath));
}
}