### Question:
FluentListAssert extends AbstractFluentAssert<FluentListAssert, FluentList> implements ListStateAssert, ListAttributeAssert { @Override public FluentListAssert hasText(String textToFind) { List<String> actualTexts = requiresNonEmpty(actual.texts()); if (actualTexts.stream().noneMatch(text -> text.contains(textToFind))) { failWithMessage("No selected elements contains text: " + textToFind + ". Actual texts found: " + actualTexts); } return this; } FluentListAssert(FluentList<? extends FluentWebElement> actual); @Override FluentListAssert isEmpty(); @Override FluentListAssert isNotEmpty(); @Override FluentListAssert hasSize(int expectedSize); @Override FluentListSizeBuilder hasSize(); @Override FluentListAssert hasText(String textToFind); @Override FluentListAssert hasTextContaining(String textToFind); @Override FluentListAssert hasTextMatching(String regexToBeMatched); @Override FluentListAssert hasNotText(String textToFind); @Override FluentListAssert hasNotTextContaining(String textToFind); @Override FluentListAssert hasId(String idToFind); @Override FluentListAssert hasClass(String classToFind); @Override FluentListAssert hasClasses(String... classesToFind); @Override FluentListAssert hasNotClass(String htmlClass); @Override FluentListAssert hasNotClasses(String... htmlClasses); @Override FluentListAssert hasValue(String value); @Override FluentListAssert hasName(String name); @Override FluentListAssert hasTagName(String tagName); @Override FluentListAssert hasDimension(Dimension dimension); @Override FluentListAssert hasAttributeValue(String attribute, String value); @Override ListAssert<String> hasAttribute(String attribute); @Override FluentListAssert hasNotAttribute(String attribute);  }### Answer:
@Test public void emptyListErrorMessage() { when(fluentList.texts()).thenReturn(emptyList()); assertThatThrownBy(() -> listAssert.hasText("John")) .isInstanceOf(AssertionError.class) .hasMessageContaining("List is empty. Please make sure you use correct selector."); }
@Test public void testHasTextOk() { when(fluentList.texts()).thenReturn(singletonList("some text")); listAssert.hasText("some text"); }
@Test public void testHasTextKo() { when(fluentList.texts()).thenReturn(Lists.newArrayList("some text", "other text")); assertThatAssertionErrorIsThrownBy(() -> listAssert.hasText("absent text")) .hasMessage("No selected elements contains text: absent text. " + "Actual texts found: [some text, other text]"); }