Looking at your code, I think you may be looking for model-based testing.
In model-based testing, you create a model: an explicit declarative specification of the behavior expected from your system. This is what your line
StateMachine<Human> fsm = StateMachineBuilder.create(Human.class)
This problem is call "$X$-satuated bipartite matching" or Hall's marriage problem, which is discussed at here on Wikipedia.
Consider each item as a woman. Each bag is a man. If item $a$ is allowed to be placed in bag $x$, it means woman $a$ and man $x$ can be married happily. Only one item can go in each bag corresponds to the assumption of monogamy, a man ...
Since this issue is still not quite clear even now in 2019, and it might help new ML-Learners choose,
here is a very good image showing the differences:
(localisation is the bounding box around the "sheep" class, after a classification of the image has been done)