/* * Copyright (c) 2015. Developed by Hedgecode. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.hedgecode.xml.xspf; import java.io.File; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; /** * Tests for {@link XSPF}. * * @author Dmitry Samoshin aka gotty */ @RunWith(JUnit4.class) public class XSPFTest extends Assert { private static final String XSPF_FILE_DIR = "/"; private static final String XSPF_PLAYLIST_FILE = "playlist.xspf"; private static final String XSPF_TORRENT_FILE = "torrent-tv.ru.xspf"; @Test public void testBind() throws Exception { File xspfFile = new File( XSPFTest.class.getResource( XSPF_FILE_DIR + XSPF_PLAYLIST_FILE ).toURI() ); Playlist playlist = XSPF.create(xspfFile); playlist.write( new File("test.xspf") ); } @Test public void testCreate() throws Exception { Playlist playlist = XSPF.create(XSPFConstants.Format.XSD); playlist.setTitle("Title"); playlist.setLocation("Location"); XSPF.addTrack(playlist, "a.mp3", "First MP3"); XSPF.addTrack(playlist, "b.mp3", "Second MP3"); XSPF.addTrack(playlist, "c.mp3", "Third MP3"); playlist.write( new File("test2.xspf") ); } }