1
package org.jaudiotagger.audio.asf.data;
3
import java.math.BigInteger;
6
* Test for simple {@link Chunk}.
8
* @author Christian Laireiter
10
public class ChunkTest extends AbstractChunk<Chunk> {
13
* Creates a chunk instance.
21
* @return chunk instance.
23
protected Chunk createChunk(final GUID chunkGUID, final long pos,
24
final BigInteger chunkLength) {
25
return new Chunk(chunkGUID, pos, chunkLength);
32
protected Chunk createChunk(long pos, BigInteger size) {
33
return new Chunk(GUID.GUID_UNSPECIFIED, pos, size);
37
* Tests the creation of chunks and should fail.<br>
42
* position of the chunk
45
* @return The occurred exception on
46
* {@link #createChunk(GUID,long, BigInteger)}.
48
public Exception failOn(final GUID chunkGUID, final long pos,
49
final BigInteger chunkLength) {
50
Exception result = null;
52
createChunk(chunkGUID, pos, chunkLength);
53
} catch (Exception e) {
61
* {@link org.jaudiotagger.audio.asf.data.Chunk#Chunk(GUID, BigInteger)}.
63
public void testChunk() {
64
assertTrue("IllegalArgumentException expected",
65
failOn(null, 0, null) instanceof IllegalArgumentException);
67
"IllegalArgumentException expected",
68
failOn(GUID.GUID_UNSPECIFIED, 0, null) instanceof IllegalArgumentException);
69
assertTrue("IllegalArgumentException expected", failOn(
70
GUID.GUID_UNSPECIFIED, 0, BigInteger.TEN.multiply(BigInteger
71
.valueOf(-1))) instanceof IllegalArgumentException);
72
assertNull("Should have worked fine", failOn(GUID.GUID_UNSPECIFIED, 0,
74
assertNull("Should have worked fine", failOn(GUID.GUID_UNSPECIFIED, 0,
1
package org.jaudiotagger.audio.asf.data;
3
import java.math.BigInteger;
6
* Test for simple {@link Chunk}.
8
* @author Christian Laireiter
10
public class ChunkTest extends AbstractChunk<Chunk> {
13
* Creates a chunk instance.
21
* @return chunk instance.
23
protected Chunk createChunk(final GUID chunkGUID, final long pos,
24
final BigInteger chunkLength) {
25
return new Chunk(chunkGUID, pos, chunkLength);
32
protected Chunk createChunk(long pos, BigInteger size) {
33
return new Chunk(GUID.GUID_UNSPECIFIED, pos, size);
37
* Tests the creation of chunks and should fail.<br>
42
* position of the chunk
45
* @return The occurred exception on
46
* {@link #createChunk(GUID,long, BigInteger)}.
48
public Exception failOn(final GUID chunkGUID, final long pos,
49
final BigInteger chunkLength) {
50
Exception result = null;
52
createChunk(chunkGUID, pos, chunkLength);
53
} catch (Exception e) {
61
* {@link org.jaudiotagger.audio.asf.data.Chunk#Chunk(GUID, BigInteger)}.
63
public void testChunk() {
64
assertTrue("IllegalArgumentException expected",
65
failOn(null, 0, null) instanceof IllegalArgumentException);
67
"IllegalArgumentException expected",
68
failOn(GUID.GUID_UNSPECIFIED, 0, null) instanceof IllegalArgumentException);
69
assertTrue("IllegalArgumentException expected", failOn(
70
GUID.GUID_UNSPECIFIED, 0, BigInteger.TEN.multiply(BigInteger
71
.valueOf(-1))) instanceof IllegalArgumentException);
72
assertNull("Should have worked fine", failOn(GUID.GUID_UNSPECIFIED, 0,
74
assertNull("Should have worked fine", failOn(GUID.GUID_UNSPECIFIED, 0,