2 * Copyright (c) 2015-2019. Developed by Hedgecode.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.hedgecode.xml.xspf;
21 import org.junit.Assert;
22 import org.junit.Test;
23 import org.junit.runner.RunWith;
24 import org.junit.runners.JUnit4;
27 * Tests for {@link XSPF}.
29 * @author Dmitry Samoshin aka gotty
31 @RunWith(JUnit4.class)
32 public class XSPFTest extends Assert {
34 private static final String XSPF_FILE_DIR = "/";
35 private static final String XSPF_PLAYLIST_FILE = "playlist.xspf";
36 private static final String XSPF_TORRENT_FILE = "torrent-tv.ru.xspf";
39 public void testBind() throws Exception {
41 File xspfFile = new File(
42 XSPFTest.class.getResource(
43 XSPF_FILE_DIR + XSPF_PLAYLIST_FILE
48 Playlist playlist = XSPF.create(xspfFile);
56 public void testCreate() throws Exception {
58 Playlist playlist = XSPF.create(XSPFConstants.Format.XSD);
59 playlist.setTitle("Title");
60 playlist.setLocation("Location");
61 XSPF.addTrack(playlist, "a.mp3", "First MP3");
62 XSPF.addTrack(playlist, "b.mp3", "Second MP3");
63 XSPF.addTrack(playlist, "c.mp3", "Third MP3");
65 new File("test2.xspf")