Alonso-del-Arte / toy-examples

Just a random assortment of classic object-oriented programming toy examples, some more fleshed out than others.
GNU General Public License v3.0
2 stars 6 forks source link

Get `nextObject()` to work for lists and sets #11

Open Alonso-del-Arte opened 1 year ago

Alonso-del-Arte commented 1 year ago

Hacktoberfest participants wanting to practice test-driven development (TDD) in Java, here's one for you:

Currently nextObject() in randomness.ExtendedRandom only works for arrays. There are stubs for lists and sets that always return either the first object of the list or the first object given by the set's iterator.

Your pull request should have more than one commit. In the first commit, there should be no changes to ExtendedRandom, maybe only to ExtendedRandomTest.

Don't use the same E types that I used for the array tests. Also test that nextObject() called on an empty list or set throws NoSuchElementException.