samedi 21 novembre 2020

How to construct a JUnit testing for a method that uses some random in it

I have a method that uses a set of numbers that is randomly picked (exmple, choosing 10 random num from a 1-100). I need to "use a seed" in order to create a "deterministic" set - which will allow me to preform JUnit tests for the method itself and the object it creates as a result... How do we use such a seed? (I do not want to use hard coding of the set in the function and creating a "test" flag for the method). thanks




Aucun commentaire:

Enregistrer un commentaire