use of org.robolectric.shadows.ShadowMediaPlayer.addException in project robolectric by robolectric.
the class ShadowMediaPlayerTest method testSetDataSourceCustomExceptionOverridesIllegalState.
@Test
public void testSetDataSourceCustomExceptionOverridesIllegalState() {
shadowMediaPlayer.setState(PREPARED);
ShadowMediaPlayer.addException(toDataSource("dummy"), new IOException());
try {
mediaPlayer.setDataSource("dummy");
fail("Expecting IOException to be thrown");
} catch (IOException eThrown) {
} catch (Exception eThrown) {
fail(eThrown + " was thrown, expecting IOException");
}
}
Aggregations