### Question:
MachineState { public EnumSet<E> addNewAssociation(final E state, final EnumSet<E> set) { return statemap.put(state, set); } MachineState(final E initialState,
                      final ConcurrentMap<E, EnumSet<E>> map);  MachineState(final E initialState); EnumSet<E> addNewAssociation(final E state, final EnumSet<E> set); EnumSet<E> addNewAssociation(final Transition<E> elt); EnumSet<E> removeAssociation(final E state); E getCurrent(); E setCurrent(final E desiredState); E setDryCurrent(final E desiredState); void release();  }### Answer:
@Test @SuppressWarnings({ "unchecked", "rawtypes" }) public void testMachineStateEnumStateConcurrentHashMapOfEnumStateEnumSetOfQ() { final ConcurrentHashMap<ExampleEnumState, EnumSet<ExampleEnumState>> stateMap = new ConcurrentHashMap<ExampleEnumState, EnumSet<ExampleEnumState>>(); stateMap.put(ExampleTransition.tRUNNING.elt.getState(), ExampleTransition.tRUNNING.elt.getSet()); final MachineState<ExampleEnumState> machineState1 = new MachineState(ExampleEnumState.PAUSED, stateMap); for (final ExampleTransition trans : ExampleTransition.values()) { machineState1.addNewAssociation(trans.elt); } System.out.println("Machine1 states..."); assertTrue(changeState(machineState1, ExampleEnumState.CONFIGURING)); assertTrue(changeState(machineState1, ExampleEnumState.PAUSED)); assertTrue(changeState(machineState1, ExampleEnumState.RUNNING)); assertTrue(changeState(machineState1, ExampleEnumState.ENDED)); assertFalse(changeState(machineState1, ExampleEnumState.PAUSED)); assertTrue(changeState(machineState1, ExampleEnumState.RESET)); assertTrue(changeState(machineState1, ExampleEnumState.PAUSED)); }
@Test @SuppressWarnings({ "unchecked", "rawtypes" }) public void testMachineStateEnumState() { final MachineState<ExampleEnumState> machineState2 = new MachineState(ExampleEnumState.PAUSED); for (final ExampleTransition trans : ExampleTransition.values()) { machineState2.addNewAssociation(trans.elt); } System.out.println("Machine2 states..."); assertTrue(changeState(machineState2, ExampleEnumState.CONFIGURING)); assertTrue(changeState(machineState2, ExampleEnumState.PAUSED)); assertTrue(changeState(machineState2, ExampleEnumState.RUNNING)); assertTrue(changeState(machineState2, ExampleEnumState.ENDED)); assertFalse(changeState(machineState2, ExampleEnumState.PAUSED)); assertTrue(changeState(machineState2, ExampleEnumState.RESET)); assertTrue(changeState(machineState2, ExampleEnumState.PAUSED)); }