### Question:
FluentWebElementAssert extends AbstractFluentAssert<FluentWebElementAssert, FluentWebElement> implements ElementStateAssert, ElementAttributeAssert { @Override public FluentWebElementAssert hasText(String textToFind) { String actualText = actual.text(); if (!actualText.contains(textToFind)) { failWithMessage("The element does not contain the text: " + textToFind + ". Actual text found : " + actualText); } return this; } FluentWebElementAssert(FluentWebElement actual); @Override FluentWebElementAssert isEnabled(); @Override FluentWebElementAssert isNotEnabled(); @Override FluentWebElementAssert isDisplayed(); @Override FluentWebElementAssert isNotDisplayed(); @Override FluentWebElementAssert isSelected(); @Override FluentWebElementAssert isNotSelected(); @Override FluentWebElementAssert isClickable(); @Override FluentWebElementAssert isNotClickable(); @Override FluentWebElementAssert isPresent(); @Override FluentWebElementAssert isNotPresent(); @Override FluentWebElementAssert hasText(String textToFind); @Override FluentWebElementAssert hasTextContaining(String text); @Override FluentWebElementAssert hasTextMatching(String regexToBeMatched); @Override FluentWebElementAssert hasNotText(String textToFind); @Override FluentWebElementAssert hasNotTextContaining(String textToFind); @Override FluentWebElementAssert hasId(String idToFind); @Override FluentWebElementAssert hasClass(String classToFind); @Override FluentWebElementAssert hasNotClass(String htmlClass); @Override FluentWebElementAssert hasClasses(String... classesToFind); @Override FluentWebElementAssert hasNotClasses(String... classesToFind); @Override FluentWebElementAssert hasValue(String value); @Override FluentWebElementAssert hasName(String name); @Override FluentWebElementAssert hasTagName(String tagName); @Override FluentWebElementAssert hasDimension(Dimension dimension); @Override FluentWebElementAssert hasAttributeValue(String attribute, String value); @Override AbstractStringAssert hasAttribute(String attribute); @Override FluentWebElementAssert hasNotAttribute(String attribute);  }### Answer:
@Test public void testHasTextOk() { when(element.text()).thenReturn("There is a 5% increase"); elementAssert.hasText("There is a 5% increase"); }
@Test public void testHasTextWithSpecialCharactersInElement() { String textWithStringFormatError = "%A"; when(element.text()).thenReturn(textWithStringFormatError); elementAssert.hasText(textWithStringFormatError); }
@Test public void testHasNoRaceConditionInHasText() { String textToFind = "someText"; String firstActualText = "someOtherText"; when(element.text()).thenReturn(firstActualText, textToFind); try { elementAssert.hasText(textToFind); fail("Expected assertion error"); } catch (AssertionError assertionError) { assertThat(assertionError.getMessage()).contains("Actual text found : " + firstActualText); } }