Пример #1
0
  /** Test method for {@link org.jajuk.util.filters.AudioFilter#getDescription()} . */
  public void testGetDescription() {
    StartupCollectionService.registerTypes();

    assertTrue(
        AudioFilter.getInstance().getDescription(),
        StringUtils.containsIgnoreCase(AudioFilter.getInstance().getDescription(), "mp3"));
    assertTrue(
        AudioFilter.getInstance().getDescription(),
        StringUtils.containsIgnoreCase(AudioFilter.getInstance().getDescription(), "ogg"));

    // try removing all types
    TypeManager.getInstance().clear();
    assertEquals("", AudioFilter.getInstance().getDescription());
  }
Пример #2
0
 /** Test method for {@link org.jajuk.util.filters.AudioFilter#getInstance()}. */
 public void testGetInstance() {
   assertNotNull(AudioFilter.getInstance());
 }
Пример #3
0
  /** Test method for {@link org.jajuk.util.filters.AudioFilter#accept(java.io.File)}. */
  public void testAcceptFile() {
    StartupCollectionService.registerTypes();

    // normal files
    assertFalse(AudioFilter.getInstance().accept(new File("test.tst")));
    assertTrue(AudioFilter.getInstance().accept(new File("test.mp3")));
    assertTrue(AudioFilter.getInstance().accept(new File("test.ogg")));
    assertTrue(AudioFilter.getInstance().accept(new File("test.MP3"))); // files
    // copied
    // from
    // windows
    // to
    // linux
    // might
    // be
    // uppercase
    assertTrue(AudioFilter.getInstance().accept(new File("test.OGG")));
    assertTrue(AudioFilter.getInstance().accept(new File("test.mP3"))); // manually
    // entered
    // filenames
    // might
    // be
    // lowercase/uppercase
    // mixed
    assertTrue(AudioFilter.getInstance().accept(new File("test.ogG")));

    // directories, depends on the setting
    AudioFilter.getInstance().setAcceptDirectories(false);
    assertFalse(AudioFilter.getInstance().accept(new File(System.getProperty("java.io.tmpdir"))));
    AudioFilter.getInstance().setAcceptDirectories(true);
    assertTrue(AudioFilter.getInstance().accept(new File(System.getProperty("java.io.tmpdir"))));
  }