default void requireState(final @NonNull S expected) {
        if (this.state().equals(expected)) {
            return;
        }
        throw new IllegalStateException(String.format(
                "This operation requires the command manager to be in state '%s', but it is in '%s'",
                expected,
                this.state()
        ));
    }
Requires that the current {@link #state()} is equal to the {@code expected} state, and fails
exceptionally if the states are different.

@param expected the expected state
@throws IllegalStateException if the current {@link #state()} is different from the {@code expected} state
cloud-core/src/main/java/org/incendo/cloud/state/Stateful.java