### Question:
FluentWebElementAssert extends AbstractFluentAssert<FluentWebElementAssert, FluentWebElement> implements ElementStateAssert, ElementAttributeAssert { @Override public FluentWebElementAssert hasClass(String classToFind) { String actualClasses = actual.attribute(CLASS_ATTRIBUTE); if (!getClasses(actualClasses).contains(classToFind)) { failWithMessage("The element does not have the class: " + classToFind + ". Actual class found : " + actualClasses); } 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 testHasClassOk() { when(element.attribute("class")).thenReturn("some-class"); elementAssert.hasClass("some-class"); }
@Test public void testHasClassKo() { when(element.attribute("class")).thenReturn("other-class"); assertThatAssertionErrorIsThrownBy(() -> elementAssert.hasClass("some-class")) .hasMessage("The element does not have the class: some-class. Actual class found : other-class"); }
@Test public void testHasClassSubstringKo() { when(element.attribute("class")).thenReturn("yolokitten"); assertThatAssertionErrorIsThrownBy(() -> elementAssert.hasClass("yolo")) .hasMessage("The element does not have the class: yolo. Actual class found : yolokitten"); }
@Test public void testHasMultipleClassesOk() { when(element.attribute("class")).thenReturn("yolokitten mark"); elementAssert.hasClass("mark"); }