### Question:
FluentListAssert extends AbstractFluentAssert<FluentListAssert, FluentList> implements ListStateAssert, ListAttributeAssert { @Override public FluentListAssert hasClass(String classToFind) { return validateHasClasses("No selected elements have class: ", classToFind); } 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 testHasClassOk() { when(fluentList.attributes("class")).thenReturn(Lists.newArrayList("some-class", "unknown-class")); listAssert.hasClass("some-class"); }
@Test public void testHasClassKo() { when(fluentList.attributes("class")).thenReturn(Lists.newArrayList("other-class", "unknown-class")); assertThatAssertionErrorIsThrownBy(() -> listAssert.hasClass("some-class")) .hasMessage("No selected elements have class: some-class. " + "Actual classes found : other-class, unknown-class"); }
@Test public void testHasClassEmptyKo() { when(fluentList.attributes("class")).thenReturn(emptyList()); assertThatAssertionErrorIsThrownBy(() -> listAssert.hasClass("some-class")) .hasMessage("List is empty. Please make sure you use correct selector."); }
@Test public void testSubstringKo() { when(fluentList.attributes("class")).thenReturn(singletonList("yolokitten")); assertThatAssertionErrorIsThrownBy(() -> listAssert.hasClass("yolo")) .hasMessage("No selected elements have class: yolo. Actual classes found : yolokitten"); }
@Test public void testHasMultipleClassesOk() { when(fluentList.attributes("class")).thenReturn(singletonList("yolokitten mark")); listAssert.hasClass("mark"); }
@Test public void testHasMultipleClassesOkBanana() { when(fluentList.attributes("class")).thenReturn(Arrays.asList("beta product", "alpha male")); listAssert.hasClass("male"); }