Shouldn't this throw an `IllegalStateException` rather than an `assert` statement?