Extracted a Course.hasFreeSpots from Course.getState and added some tests for getState.