Skip to content
drewbourne edited this page Sep 13, 2010 · 1 revision

emptyString matches a String if it is zero-length, or contains only whitespace.

  assertThat(textInput.text, not(emptyString()));

containsString matches a String if it contains the given substring.

  assertThat("The quick brown fox", containsString("fox"));

startsWith matches a String if it starts with the given substring.

  assertThat("The quick brown fox", startsWith("The"));

endsWith matches a String if it ends with the given substring.

  assertThat("The quick brown fox", endsWith("fox"));

re matches a String if it matches the given RegExp.

  assertThat("has some whitespace", "The quick brown fox", re(/\s+/));