Comment Odd assumption in first question (Score 1) 62
Describing a dog-walking company, we have:
"Returns the number of dogs, always greater than 0, that are available for a walk during the time specified by hour"
"always greater than 0"? As this means that every compliant dog-walking company must never run out of dogs to walk, how could one start a dog-walking company? To even exist, it must already have registered dogs — available to be walked at any hour of day or night — or it cannot be instantiated in a valid manner.
Is there an unspecified requirement that one must never investigate the number of dogs to walk without already knowing that there are dogs available to walk, and that it causes undefined behavior or an unstated exception? If so, why is there no such test (e.g. isDogAvailable(int hour)) available in the API?
Perhaps the right answer is to reject this broken API, or to correct its contracts to say "no less than 0". Or perhaps to muddle through and pretend that the commented contracts are irrelevant? Regardless, I'm puzzled as to how a test question would come to exist.