BackgroundMusicManager { MediaPlayer createMediaPlayer(String source) { try { final Media media = new Media(source); final MediaPlayer player = makeMediaPlayer(media); player.setOnError(() -> log.error("error on audio media loading : " + player.getError())); player.volumeProperty().bindBidirectional(ActiveConfigurationContext.getInstance().getMusicVolumeProperty()); player.setOnEndOfMedia(this::next); return player; } catch (MediaException e) { log.error("error while loading media {}, type : {}", source, e.getType(), e); } return null; } BackgroundMusicManager(); static void onConfigurationChanged(); void onEndGame(); void getAudioFromFolder(String folderPath); boolean isPlaying(); void changeMusic(int newMusicIndex); void emptyPlaylist(); void backupPlaylist(); void restorePlaylist(); void pause(); void play(); void stop(); void next(); void previous(); void setVolume(double value); void playMusicAlone(String resourceUrlAsString); static String getMusicTitle(final MediaPlayer music); static String getMusicTitle(final String musicPath); ReadOnlyBooleanProperty getIsMusicChanging();  }
@Test void shouldReturnNullOnError() { final String uri = new File(localDataFolder + "test.properties").toURI().toString(); mediaPlayer = musicManagerSpy.createMediaPlayer(uri); assertNull(mediaPlayer); }