~ubuntu-branches/ubuntu/trusty/libjaudiotagger-java/trusty

« back to all changes in this revision

Viewing changes to srctest/org/jaudiotagger/audio/asf/AsfCodeCheckTest.java

  • Committer: Bazaar Package Importer
  • Author(s): Damien Raude-Morvan
  • Date: 2011-04-28 23:52:43 UTC
  • mfrom: (3.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20110428235243-pzalvw6lncis3ukf
Tags: 2.0.3-1
* d/control: Drop Depends on default-jre per Debian Java Policy as its
  a library package.
* d/watch: Fix to directly monitor SVN tags.
* Switch to 3.0 (quilt) format.
* Bump Standards-Version to 3.9.2 (no changes needed).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
package org.jaudiotagger.audio.asf;
2
 
 
3
 
import junit.framework.TestCase;
4
 
import org.jaudiotagger.audio.asf.data.AsfHeader;
5
 
import org.jaudiotagger.audio.asf.tag.AsfFieldKey;
6
 
import org.jaudiotagger.audio.asf.tag.AsfTag;
7
 
import org.jaudiotagger.tag.FieldKey;
8
 
 
9
 
/**
10
 
 * This test covers some mistakes that could be made by changing the implementation.<br>
11
 
 * For example, constants which are assigned at class loading being <code>null</code>.  
12
 
 * 
13
 
 * @author Christian Laireiter
14
 
 */
15
 
public class AsfCodeCheckTest extends TestCase
16
 
{
17
 
    
18
 
    /**
19
 
     * Tests the correct implementation of {@link AsfTag}.<br>
20
 
     * For example if {@link AsfTag#createAlbumField(String)} returns a field whose {@link org.jaudiotagger.tag.TagField#getId()} 
21
 
     * equals {@link org.jaudiotagger.audio.asf.tag.AsfFieldKey#ALBUM}s }.
22
 
     */
23
 
    public void testAsfTagImpl() throws Exception
24
 
    {
25
 
        final AsfTag asfTag = new AsfTag();
26
 
        assertEquals(asfTag.createField(FieldKey.ALBUM,new String()).getId(), AsfFieldKey.ALBUM.getFieldName());
27
 
        assertEquals(asfTag.createField(FieldKey.ARTIST,new String()).getId(), AsfFieldKey.AUTHOR.getFieldName());
28
 
        assertEquals(asfTag.createField(FieldKey.COMMENT,new String()).getId(), AsfFieldKey.DESCRIPTION.getFieldName());
29
 
        assertEquals(asfTag.createField(FieldKey.GENRE,new String()).getId(), AsfFieldKey.GENRE.getFieldName());
30
 
        assertEquals(asfTag.createField(FieldKey.TITLE,new String()).getId(), AsfFieldKey.TITLE.getFieldName());
31
 
        assertEquals(asfTag.createField(FieldKey.TRACK,new String()).getId(), AsfFieldKey.TRACK.getFieldName());
32
 
        assertEquals(asfTag.createField(FieldKey.YEAR,new String()).getId(),  AsfFieldKey.YEAR.getFieldName());
33
 
    }
34
 
 
35
 
    /**
36
 
     * Tests some constants which must have values.
37
 
     */
38
 
    public void testConstants()
39
 
    {
40
 
        // UTF16-LE by specification
41
 
        assertEquals("ONLY \"UTF-16LE\" text encoding specified", "UTF-16LE", AsfHeader.ASF_CHARSET.name()); // $NON-NLS-1$ //$NON-NLS-2$ 
42
 
    }
43
 
}
 
1
package org.jaudiotagger.audio.asf;
 
2
 
 
3
import junit.framework.TestCase;
 
4
import org.jaudiotagger.audio.asf.data.AsfHeader;
 
5
import org.jaudiotagger.tag.asf.AsfFieldKey;
 
6
import org.jaudiotagger.tag.asf.AsfTag;
 
7
import org.jaudiotagger.tag.FieldKey;
 
8
 
 
9
/**
 
10
 * This test covers some mistakes that could be made by changing the implementation.<br>
 
11
 * For example, constants which are assigned at class loading being <code>null</code>.  
 
12
 * 
 
13
 * @author Christian Laireiter
 
14
 */
 
15
public class AsfCodeCheckTest extends TestCase
 
16
{
 
17
    
 
18
    /**
 
19
     * Tests the correct implementation of {@link AsfTag}.<br>
 
20
     * For example if {@link AsfTag#createAlbumField(String)} returns a field whose {@link org.jaudiotagger.tag.TagField#getId()} 
 
21
     * equals {@link org.jaudiotagger.tag.asf.AsfFieldKey#ALBUM}s }.
 
22
     */
 
23
    public void testAsfTagImpl() throws Exception
 
24
    {
 
25
        final AsfTag asfTag = new AsfTag();
 
26
        assertEquals(asfTag.createField(FieldKey.ALBUM,new String()).getId(), AsfFieldKey.ALBUM.getFieldName());
 
27
        assertEquals(asfTag.createField(FieldKey.ARTIST,new String()).getId(), AsfFieldKey.AUTHOR.getFieldName());
 
28
        assertEquals(asfTag.createField(FieldKey.COMMENT,new String()).getId(), AsfFieldKey.DESCRIPTION.getFieldName());
 
29
        assertEquals(asfTag.createField(FieldKey.GENRE,new String()).getId(), AsfFieldKey.GENRE.getFieldName());
 
30
        assertEquals(asfTag.createField(FieldKey.TITLE,new String()).getId(), AsfFieldKey.TITLE.getFieldName());
 
31
        assertEquals(asfTag.createField(FieldKey.TRACK,new String()).getId(), AsfFieldKey.TRACK.getFieldName());
 
32
        assertEquals(asfTag.createField(FieldKey.YEAR,new String()).getId(),  AsfFieldKey.YEAR.getFieldName());
 
33
    }
 
34
 
 
35
    /**
 
36
     * Tests some constants which must have values.
 
37
     */
 
38
    public void testConstants()
 
39
    {
 
40
        // UTF16-LE by specification
 
41
        assertEquals("ONLY \"UTF-16LE\" text encoding specified", "UTF-16LE", AsfHeader.ASF_CHARSET.name()); // $NON-NLS-1$ //$NON-NLS-2$ 
 
42
    }
 
43
}