X-Git-Url: https://git.hedgecode.org/?p=hespiff.git;a=blobdiff_plain;f=src%2Ftest%2Fjava%2Forg%2Fhedgecode%2Fxml%2Fxspf%2FXSPFTest.java;fp=src%2Ftest%2Fjava%2Forg%2Fhedgecode%2Fxml%2Fxspf%2FXSPFTest.java;h=aedc50be4ce3a30aff1133bc5636259f04c98bc6;hp=0000000000000000000000000000000000000000;hb=6310cd885e1db660feb7dc222c2e86cccb5c1fce;hpb=13dba5ab997fc65d1da26de66a49b9a930b81f12 diff --git a/src/test/java/org/hedgecode/xml/xspf/XSPFTest.java b/src/test/java/org/hedgecode/xml/xspf/XSPFTest.java new file mode 100644 index 0000000..aedc50b --- /dev/null +++ b/src/test/java/org/hedgecode/xml/xspf/XSPFTest.java @@ -0,0 +1,69 @@ +/* + * 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") + ); + } + +}