test_class.declarator: mockGameContext
test_class.modifier: @Mock(answer = Answers.RETURNS_DEEP_STUBS)
test_class.original_string: @Mock(answer = Answers.RETURNS_DEEP_STUBS)
      IGameContext mockGameContext;
test_class.type: IGameContext
test_class.var_name: mockGameContext
test_class.declarator: testDir = new File("src/test/resources/testTestForMediaFileReader")
test_class.modifier: private static
test_class.original_string: private static File testDir = new File("src/test/resources/testTestForMediaFileReader");
test_class.type: File
test_class.var_name: testDir
test_class.file: gazeplay-games/src/test/java/net/gazeplay/games/mediaPlayer/MediaFileReaderTest.java
test_class.identifier: MediaFileReaderTest
test_case.body: @Test
      void shouldAddMedia() {
          MediaFileReader mfr = new MediaFileReader(mockGameContext) {
              @Override
              public File getMediaPlayerDirectory() {
                  return testDir;
              }
          };
          MediaFile mediaTypeMediaFile = new MediaFile("MEDIA", "https://www.testMEDIA.fr/", "testMEDIA", "images/green/green.jpg");
          mfr.addMedia(mediaTypeMediaFile);
          assertTrue(mfr.getMediaList().contains(mediaTypeMediaFile));
  
  
          MediaFile urlTypeMediaFile = new MediaFile("URL", "https://www.testURL.fr/", "testURL", "images/green/green.jpg");
          mfr.addMedia(urlTypeMediaFile);
          assertTrue(mfr.getMediaList().contains(mediaTypeMediaFile));
          assertTrue(mfr.getMediaList().contains(urlTypeMediaFile));
      }
test_case.class_method_signature: MediaFileReaderTest.shouldAddMedia()
test_case.full_signature: @Test void shouldAddMedia()
test_case.identifier: shouldAddMedia
test_case.invocations: addMedia assertTrue contains getMediaList addMedia assertTrue contains getMediaList assertTrue contains getMediaList
test_case.modifiers: @Test
test_case.parameters: ()
test_case.return: void
test_case.signature: void shouldAddMedia()
focal_class.declarator: PLAYER_LIST_CSV = "playerList.csv"
focal_class.modifier: private static final
focal_class.original_string: private static final String PLAYER_LIST_CSV = "playerList.csv";
focal_class.type: String
focal_class.var_name: PLAYER_LIST_CSV
focal_class.declarator: gameContext
focal_class.modifier: private final
focal_class.original_string: private final IGameContext gameContext;
focal_class.type: IGameContext
focal_class.var_name: gameContext
focal_class.declarator: mediaList
focal_class.modifier: @Getter
      private final
focal_class.original_string: @Getter
      private final List<MediaFile> mediaList;
focal_class.type: List<MediaFile>
focal_class.var_name: mediaList
focal_class.declarator: firstMediaDisplayedIndex
focal_class.modifier: @Getter
      private
focal_class.original_string: @Getter
      private SimpleIntegerProperty firstMediaDisplayedIndex;
focal_class.type: SimpleIntegerProperty
focal_class.var_name: firstMediaDisplayedIndex
focal_class.declarator: playingMediaIndex
focal_class.modifier: @Getter
      private
focal_class.original_string: @Getter
      private SimpleIntegerProperty playingMediaIndex;
focal_class.type: SimpleIntegerProperty
focal_class.var_name: playingMediaIndex
focal_class.file: gazeplay-games/src/main/java/net/gazeplay/games/mediaPlayer/MediaFileReader.java
focal_class.identifier: MediaFileReader
focal_class.class_method_signature: MediaFileReader.MediaFileReader(IGameContext gameContext)
focal_class.full_signature:   MediaFileReader(IGameContext gameContext)
focal_class.identifier: MediaFileReader
focal_class.parameters: (IGameContext gameContext)
focal_class.signature:  MediaFileReader(IGameContext gameContext)
focal_class.class_method_signature: MediaFileReader.setPlayingMediaIndex(int newIndex)
focal_class.full_signature: public void setPlayingMediaIndex(int newIndex)
focal_class.identifier: setPlayingMediaIndex
focal_class.modifiers: public
focal_class.parameters: (int newIndex)
focal_class.return: void
focal_class.signature: void setPlayingMediaIndex(int newIndex)
focal_class.class_method_signature: MediaFileReader.next()
focal_class.full_signature: public void next()
focal_class.identifier: next
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void next()
focal_class.class_method_signature: MediaFileReader.previous()
focal_class.full_signature:  void previous()
focal_class.identifier: previous
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void previous()
focal_class.class_method_signature: MediaFileReader.mediaToPlayNext()
focal_class.full_signature:  MediaFile mediaToPlayNext()
focal_class.identifier: mediaToPlayNext
focal_class.parameters: ()
focal_class.return: MediaFile
focal_class.signature: MediaFile mediaToPlayNext()
focal_class.class_method_signature: MediaFileReader.mediaToPlayPrevious()
focal_class.full_signature:  MediaFile mediaToPlayPrevious()
focal_class.identifier: mediaToPlayPrevious
focal_class.parameters: ()
focal_class.return: MediaFile
focal_class.signature: MediaFile mediaToPlayPrevious()
focal_class.class_method_signature: MediaFileReader.getIndexOfFirstToDisplay()
focal_class.full_signature:  int getIndexOfFirstToDisplay()
focal_class.identifier: getIndexOfFirstToDisplay
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getIndexOfFirstToDisplay()
focal_class.class_method_signature: MediaFileReader.addMedia(MediaFile mf)
focal_class.full_signature:  void addMedia(MediaFile mf)
focal_class.identifier: addMedia
focal_class.parameters: (MediaFile mf)
focal_class.return: void
focal_class.signature: void addMedia(MediaFile mf)
focal_class.class_method_signature: MediaFileReader.getMediaPlayerDirectory()
focal_class.full_signature: public File getMediaPlayerDirectory()
focal_class.identifier: getMediaPlayerDirectory
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: File
focal_class.signature: File getMediaPlayerDirectory()
focal_method.body: void addMedia(MediaFile mf) {
          final File mediaPlayerDirectory = getMediaPlayerDirectory();
          boolean mediaPlayerDirectoryCreated = mediaPlayerDirectory.mkdirs();
          log.debug("mediaPlayerDirectoryCreated = {}", mediaPlayerDirectoryCreated);
          final File playlistFile = new File(mediaPlayerDirectory, PLAYER_LIST_CSV);
  
          try {
              boolean fileIsUsable = playlistFile.exists();
              if (!fileIsUsable) {
                  fileIsUsable = playlistFile.createNewFile();
              }
  
              if (fileIsUsable) {
                  try (
                      OutputStream fileOutputStream = Files.newOutputStream(playlistFile.toPath(), StandardOpenOption.CREATE, APPEND);
                      BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fileOutputStream, StandardCharsets.UTF_8))
                  ) {
                      if (mediaList.size() == 0) {
                          bw.write("" + mf.getType() + "," + mf.getPath() + "," + mf.getName() + "," + mf.getImagepath());
                      } else {
                          bw.write("\n" + mf.getType() + "," + mf.getPath() + "," + mf.getName() + "," + mf.getImagepath());
                      }
                  }
              }
          } catch (IOException e) {
              throw new RuntimeException(e);
          }
  
          mediaList.add(mf);
          firstMediaDisplayedIndex.setValue(mediaList.size() - 1);
      }
focal_method.class_method_signature: MediaFileReader.addMedia(MediaFile mf)
focal_method.full_signature:  void addMedia(MediaFile mf)
focal_method.identifier: addMedia
focal_method.invocations: getMediaPlayerDirectory mkdirs debug exists createNewFile newOutputStream toPath size write getType getPath getName getImagepath write getType getPath getName getImagepath add setValue size
focal_method.parameters: (MediaFile mf)
focal_method.return: void
focal_method.signature: void addMedia(MediaFile mf)