shadows/framework/src/main/java/org/robolectric/shadows/ShadowMediaPlayer.java
private void checkStateLog(String method, EnumSet<State> allowedStates) {
    switch (invalidStateBehavior) {
    case SILENT:
      break;
    case EMULATE:
      if (state == END) {
        String msg = "Can't call " + method + " from state " + state;
        throw new IllegalStateException(msg);
      }
      break;
    case ASSERT:
      if (!allowedStates.contains(state) || state == END) {
        String msg = "Can't call " + method + " from state " + state;
        throw new AssertionError(msg);
      }
    }
  }
private void checkStateLog(String method, EnumSet<State> allowedStates) {
    switch (invalidStateBehavior) {
    case SILENT:
      break;
    case EMULATE:
      if (state == END) {
        String msg = "Can't call " + method + " from state " + state;
        throw new IllegalStateException(msg);
      }
      break;
    case ASSERT:
      if (!allowedStates.contains(state) || state == END) {
        String msg = "Can't call " + method + " from state " + state;
        throw new AssertionError(msg);
      }
    }
  }
private void checkStateLog ( String method , EnumSet < State > allowedStates ) { switch ( invalidStateBehavior ) { case SILENT : break ; case EMULATE : if ( state == END ) { String msg = "Can't call " + method + " from state " + state ; throw new IllegalStateException ( msg ) ; } break ; case ASSERT : if ( ! allowedStates . contains ( state ) || state == END ) { String msg = "Can't call " + method + " from state " + state ; throw new AssertionError ( msg ) ; } } }
Checks states for methods that only log when there is an error. Such
methods throw an {@link IllegalArgumentException} when invoked in the END
state, but log an error in other disallowed states. This method will either
emulate this behavior or else will generate an assertion if invoked from a
disallowed state if {@link #setAssertOnError assertOnError} is set.

@param method
the name of the method being tested.
@param allowedStates
the states that this method is allowed to be called from.
@see #setAssertOnError
@see #checkStateError(String, EnumSet)
@see #checkStateException(String, EnumSet)
Checks states for methods that only log when there is an error . Such methods throw an { @link IllegalArgumentException } when invoked in the END state but log an error in other disallowed states . This method will either emulate this behavior or else will generate an assertion if invoked from a disallowed state if { @link #setAssertOnError assertOnError } is set .