本文整理匯總了Java中org.jbehave.core.annotations.Then類的典型用法代碼示例。如果您正苦於以下問題:Java Then類的具體用法?Java Then怎麽用?Java Then使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Then類屬於org.jbehave.core.annotations包,在下文中一共展示了Then類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: IReceiveTheClusterAndItsStatus
import org.jbehave.core.annotations.Then; //導入依賴的package包/類
@Then("Kafka cluster status is $status")
public void IReceiveTheClusterAndItsStatus(@Named("$status") String status) throws InterruptedException {
switch (status) {
case "OK":
while(kfMonitor.getCluster().getKfClusterStatus() != KFClusterStatusName.OK) {
Thread.sleep(500);
}
Assert.assertTrue(kfMonitor.getCluster().getKfClusterStatus() == KFClusterStatusName.OK);
break;
case "WARNING":
while(kfMonitor.getCluster().getKfClusterStatus() != KFClusterStatusName.WARNING) {
Thread.sleep(500);
}
Assert.assertTrue(kfMonitor.getCluster().getKfClusterStatus() == KFClusterStatusName.WARNING);
break;
case "DOWN":
while(kfMonitor.getCluster().getKfClusterStatus() != KFClusterStatusName.DOWN) {
Thread.sleep(500);
}
Assert.assertTrue(kfMonitor.getCluster().getKfClusterStatus() == KFClusterStatusName.DOWN);
break;
default:
break;
}
}
示例2: IReceiveTheClusterAndItsStatus
import org.jbehave.core.annotations.Then; //導入依賴的package包/類
@Then("Kafka cluster status is $status")
public void IReceiveTheClusterAndItsStatus(@Named("$status") String status) throws InterruptedException {
switch (status) {
case "OK":
while(kfMonitor.getCluster().getKfClusterStatus() != KFClusterStatusName.OK) {
Thread.sleep(500);
}
Assert.assertTrue(kfMonitor.getCluster().getKfClusterStatus() == KFClusterStatusName.OK);
break;
case "WARNING":
while(kfMonitor.getCluster().getKfClusterStatus() != KFClusterStatusName.WARNING) {
Thread.sleep(500);
}
Assert.assertTrue(kfMonitor.getCluster().getKfClusterStatus() == KFClusterStatusName.WARNING);
break;
case "DOWN":
while(kfMonitor.getCluster().getKfClusterStatus() != KFClusterStatusName.DOWN) {
Thread.sleep(500);
}
Assert.assertTrue(kfMonitor.getCluster().getKfClusterStatus() == KFClusterStatusName.DOWN);
break;
default:
break;
}
}
示例3: getAllTopicsHasSize
import org.jbehave.core.annotations.Then; //導入依賴的package包/類
@Then("I call all topics and there are $topic_size topics")
public void getAllTopicsHasSize(int topic_size) throws InterruptedException {
try (TopicService topicService = new TopicServiceBuilder(zkEndpoints)
.withZKConnectionTimeout(zKConnectionTimeout)
.withZKSessionTimeout(zKSessionTimeout)
.build()) {
int topicListSize = topicService.getAllTopics().size();
assertThat("The topic list size expected is " + topicListSize
+ " It was expected: " + topic_size + "" +
" - topics available: " + topicService.getAllTopics(),
topicListSize, is(topic_size));
} catch (Exception e) {
e.printStackTrace();
fail("ERROR: " + e.getMessage());
}
}
示例4: thenXMLResponseSimilarToFile
import org.jbehave.core.annotations.Then; //導入依賴的package包/類
@Then("verify REST-XML response is similar to '$file'")
public void thenXMLResponseSimilarToFile(String file) throws IOException, SAXException {
File fileFromResources = getFileFromResourcesByFilePath(file);
List<String> expected = Files.readLines(fileFromResources, Charset.defaultCharset());
String expectedXml = expected.stream()
.map(StringUtils::chomp)
.map(StringUtils::strip)
.collect(Collectors.joining());
Response response = getVariableValue(KEY);
String actualXml = response.getBody().asString();
Diff diff = new Diff(expectedXml, actualXml);
diff.overrideDifferenceListener(new IgnoreTextAndAttributeValuesDifferenceListener());
StringBuffer stringBuffer = diff.appendMessage(new StringBuffer());
stringBuffer.append("\nExpected: ")
.append(expectedXml)
.append("\n but: ")
.append(actualXml)
.append("\n");
assertTrue(stringBuffer.toString(), diff.similar());
}
示例5: pageLoaded
import org.jbehave.core.annotations.Then; //導入依賴的package包/類
@Step
@Then("загружена страница \"$screenName\"")
public void pageLoaded(@Named("$screenName") String screenName) {
List<IElement> elements = pageProvider.getPageByName(screenName).getSpecificElements();
for (IElement element : elements) {
WebElement webElement = finder.findWebElement(element);
if (webElement == null)
throw new PageNoLoadException(screenName);
}
testContext.setCurrentPageName(screenName);
}
示例6: optionalPageLoaded
import org.jbehave.core.annotations.Then; //導入依賴的package包/類
@Step
@Then("(Optional) загружена страница \"$screenName\"")
public void optionalPageLoaded(@Named("$screenName") String screenName) {
try {
pageLoaded(screenName);
} catch (Exception ignored) {
}
}
示例7: checkElement
import org.jbehave.core.annotations.Then; //導入依賴的package包/類
@Step
@Then("на экране есть \"$elementName\"")
public void checkElement(@Named("$elementName") String elementName) {
WebElement webElement = getWebElementByName(elementName);
if (webElement == null) {
throw new ElementNotFoundException(elementName, getCurrentPage().getName());
}
}
示例8: listItemCheck
import org.jbehave.core.annotations.Then; //導入依賴的package包/類
@Step
@Then("количество найденных элементов \"$fieldName\" равно \"$quantityExpectedValue\"")
public void listItemCheck(@Named("$fieldName") String fieldName, @Named("$quantityExpectedValue") String quantityExpectedValue) {
IElement element = getCurrentPage().getElementByName(fieldName);
List<WebElement> elementsFound = finder.findWebElements(element);
int quantityActualElements = elementsFound.size();
quantityExpectedValue = propertyUtils.injectProperties(quantityExpectedValue);
assertTrue(format("количество найденных элементов [%s] не равно [%s]", quantityActualElements, quantityExpectedValue), quantityActualElements == Integer.parseInt(quantityExpectedValue));
}
示例9: eachElementContainsValue
import org.jbehave.core.annotations.Then; //導入依賴的package包/類
@Step
@Then("каждый элемент \"$elementName\" содержит значение \"$template\" без учета регистра")
public void eachElementContainsValue(@Named("$elementName") String elementName, @Named("$template") String template) {
IElement element = getCurrentPage().getElementByName(elementName);
List<WebElement> elementsFound = finder.findWebElements(element);
String expectedValue = propertyUtils.injectProperties(template);
elementsFound.forEach(elem -> {
assertThat("Элемент не содержит заданное значение", elem.getText().toLowerCase(), containsString(expectedValue.toLowerCase()));
});
}
示例10: eachElementContainsOneOfTwoValues
import org.jbehave.core.annotations.Then; //導入依賴的package包/類
@Step
@Then("каждый элемент \"$elementName\" содержит любое из значений \"$template1\" или \"$template2\" без учета регистра")
public void eachElementContainsOneOfTwoValues(@Named("$elementName") String elementName, @Named("$template1") String templateOne, @Named("$template2") String templateTwo) {
IElement element = getCurrentPage().getElementByName(elementName);
List<WebElement> elementsFound = finder.findWebElements(element);
String expectedValueOne = propertyUtils.injectProperties(templateOne);
String expectedValueTwo = propertyUtils.injectProperties(templateTwo);
elementsFound.forEach(elem -> {
assertThat("Элемент не содержит ни одно из заданных значений", elem.getText().toLowerCase(), CoreMatchers.anyOf(
containsString(expectedValueOne.toLowerCase()),
containsString(expectedValueTwo.toLowerCase())
));
});
}
示例11: stepCheckValue
import org.jbehave.core.annotations.Then; //導入依賴的package包/類
@Step
@Then("значение элемента \"$fieldName\" равно \"$expectedValueOrKeyword\"")
public void stepCheckValue(String fieldName, String expectedValueOrKeyword) {
WebElement webElement = getWebElementByName(fieldName);
String actualElement = webElement.getText();
String expectedValue = propertyUtils.injectProperties(expectedValueOrKeyword);
assertEquals(format("Значение поля [%s] не соответствует ожидаемому [%s]", actualElement, expectedValue), expectedValue, actualElement);
}
示例12: stepCheckContainsValue
import org.jbehave.core.annotations.Then; //導入依賴的package包/類
@Step
@Then("значение элемента \"$fieldName\" содержит \"$expectedValueOrKeyword\"")
public void stepCheckContainsValue(String fieldName, String expectedValueOrKeyword) {
WebElement webElement = getWebElementByName(fieldName);
String actualElement = webElement.getText();
String expectedValue = propertyUtils.injectProperties(expectedValueOrKeyword);
assertTrue(format("Элемент [%s] не сожержит внутри себя такой элемент [%s]", actualElement, expectedValue), actualElement.contains(expectedValue));
}
示例13: checkNoElement
import org.jbehave.core.annotations.Then; //導入依賴的package包/類
@Step
@Then("на экране нет \"$elementName\"")
public void checkNoElement(@Named("$elementName") String elementName) {
IElement element = getCurrentPage().getElementByName(elementName);
try {
finder.findWebElement(element);
throw new ElementFoundOnPageException(elementName, getCurrentPage().getName());
} catch (Exception ignored) {
}
}
示例14: thenZookeeperClusterHasQuorum
import org.jbehave.core.annotations.Then; //導入依賴的package包/類
@Then("Zookeeper cluster has quorum")
public void thenZookeeperClusterHasQuorum() throws InterruptedException {
while(zkMonitor.getCluster().getZookeeperClusterStatus() != ZKClusterStatusName.QUORUM) {
Thread.sleep(500);
}
Assert.assertTrue(zkMonitor.getCluster().getZookeeperClusterStatus() == ZKClusterStatusName.QUORUM);
}
示例15: thenZookeeperNodeIsDOWN
import org.jbehave.core.annotations.Then; //導入依賴的package包/類
@Then("$zkNodeName node is DOWN")
public void thenZookeeperNodeIsDOWN(@Named("$zkNodeName") String zkNodeName) throws InterruptedException {
for(ZKNode zkNode : zkMonitor.getCluster().getZKNodes()) {
if(zkNode.getZKNodeId().equals(zkNodeName+":2181")){
Assert.assertTrue(zkNode.getZkNodeStatus() == ZKNodeStatusName.DOWN);
}
}
}