beNullOrEmpty method

StringAssertions beNullOrEmpty()

Asserts that a string is either null or '' />.

Implementation

StringAssertions beNullOrEmpty() {
  if (isReversed) {
    if (subject == null || subject == '') {
      throw ShouldlyTestFailureError(
        "Expected $subjectLabel\n${ShouldlySettings.pads}should not be null or empty\nbut was\n${ShouldlySettings.pads}'$subject'",
      );
    }
    return StringAssertions(subject);
  } else {
    if (subject != null && subject != '') {
      throw ShouldlyTestFailureError(
        "Expected $subjectLabel\n${ShouldlySettings.pads}should be null or empty\nbut was\n${ShouldlySettings.pads}'$subject'",
      );
    }
  }

  return copy(subject);
}