public boolean hasState() {
        for (StateObject state : stateObjects) {
            if (state != null) {
                return true;
            }
        }
        return false;
    }
@Test
    void testHasState() {
        StateObjectCollection<StateObject> stateObjects =
                new StateObjectCollection<>(new ArrayList<>());
        assertThat(stateObjects.hasState()).isFalse();

        stateObjects = new StateObjectCollection<>(Collections.singletonList(null));
        assertThat(stateObjects.hasState()).isFalse();

        stateObjects =
                new StateObjectCollection<>(Collections.singletonList(mock(StateObject.class)));
        assertThat(stateObjects.hasState()).isTrue();
    }