What method is used in AssertJ to check if a string is empty?
A) isEmpty()
B) isNull()
C) isBlank()
D) isNotNull()
Answer:
A) isEmpty()
Explanation:
The isEmpty()
method in AssertJ is used to assert that a string is empty. It checks whether the string contains no characters.
For example:
import static org.assertj.core.api.Assertions.assertThat;
String emptyString = "";
assertThat(emptyString).isEmpty();
In this example, the isEmpty()
method asserts that the string emptyString
is empty.