Skip to content

Add AbstractCharSequenceAssert#doesNotHaveAny(Leading|Trailing)Whitespaces #3433

@onacit

Description

@onacit

Feature summary

Sometimes, I need to verify that a String shouldn't have any leading/trailing whitespaces which means the trim() or strip() should be applied to the actual value.

Example

String s = parseValue();
assertThat(s)
        .isNotNull()
        .satisfies(v -> {
            assertThat(v.strip()).isEqualTo(v); // any alternatives?
        })
       .doesNotHaveAnyLeadingWhitespaces()
       .doesNotHaveAnyTrailingWhitespaces()
;

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions