Java 类org.assertj.core.api.StringAssert 实例源码

项目:bidij    文件:SshStepdefs.java   
@Then("^within (\\d+) (seconds?|minutes?), the ssh session output should (contain|satisfy) \"(.*?)\"$")
public void assertSshOutputVerifies(long timeout,
                                    String timeoutUnit,
                                    String comparator,
                                    String expectedText) throws Throwable {
    TimeUnit unit;
    if (timeoutUnit.toLowerCase().startsWith("minute"))
        unit = TimeUnit.MINUTES;
    else if (timeoutUnit.toLowerCase().startsWith("second"))
        unit = TimeUnit.SECONDS;
    else {
        unit = TimeUnit.SECONDS;
        Assertions.fail("Unrecognized timeunit");
    }


    await().atMost(timeout, unit).until(() -> {
                SshSession sshSession = sshWorld.peekSession();
                String out = sshSession.getOut();
                StringAssert stringAssert = assertThat(out);
                switch (comparator) {
                    case "contain":
                        stringAssert.contains(expectedText);
                        break;
                    case "satisfy":
                        Pattern p = Pattern.compile(expectedText);
                        assertThat(p.matcher(out).find()).isTrue();
                }
            }
    );
}
项目:assertj-core    文件:ClassBasedNavigableList_withString_Test.java   
@Test
public void should_navigate_to_list_elements_and_perform_specific_string_assertions() {
  List<String> list = newArrayList("one", "two", "three");

  assertThat(list, StringAssert.class).first().startsWith("o");
  assertThat(list, StringAssert.class).last().endsWith("ee");
  assertThat(list, StringAssert.class).element(1).contains("w");
}
项目:assertj-core    文件:ClassBasedNavigableList_withString_Test.java   
@Test
public void should_honor_list_assertions() {
  List<String> list = newArrayList("one", "two", "three");

  assertThat(list, StringAssert.class).contains("one", atIndex(0))
                                      .first().startsWith("o");
}
项目:arquillian-reporter    文件:IdentifierAssert.java   
public StringAssert sectionId(){
    return new StringAssert(actual.getSectionId());
}
项目:arquillian-reporter    文件:StringKeyAssert.java   
public StringAssert value(){
    return new StringAssert(actual.getValue());
}
项目:arquillian-reporter    文件:StringKeyAssert.java   
public StringAssert description(){
    return new StringAssert(actual.getDescription());
}
项目:arquillian-reporter    文件:StringKeyAssert.java   
public StringAssert icon(){
    return new StringAssert(actual.getIcon());
}
项目:assertj-core    文件:FactoryBasedNavigableList_withString_Test.java   
@Override
public StringAssert createAssert(String string) {
  return new StringAssert(string);
}
项目:demyo    文件:WebDriverAssertions.java   
/**
 * Returns a {@link StringAssert} for the textual content of this element.
 * 
 * @return The assert.
 */
public StringAssert textContent() {
    return new StringAssert(actual.getText());
}