code: public static void failIfWrongStateAfterWhileState(final DeviceProxy deviceProxy, final DevState expected,
  	    final DevState waitState, final long timeout, final long polling) throws DevFailed, TimeoutException {
  	waitWhileState(deviceProxy, waitState, timeout, polling);
  	if (!expected.equals(deviceProxy.state())) {
  		throw DevFailedUtils.newDevFailed("State not reach", "fail to reach state "
  		    + TangoConst.Tango_DevStateName[expected.value()] + " after wait "
  		    + TangoConst.Tango_DevStateName[waitState.value()]);
  	}
      }
docs: Wait while waitState does not change, and check the final finale
  
  @param deviceProxy
  the proxy on which to monitor the state
  @param expected
  the final expected state. Throw DevFailed the final state f is not the expected one
  @param waitState
  the state to wait
  @param timeout
  a timeout in ms
  @param polling
  the polling period in ms
  @throws DevFailed
  @throws TimeoutException