Major test overhaul, now uses JUnit 4 annotation style tests.

This commit is contained in:
Harald Kuhr
2011-10-18 20:16:32 +02:00
parent 4b77d1c22a
commit 9cafe4d9a9
26 changed files with 350 additions and 104 deletions

View File

@@ -29,11 +29,14 @@
package com.twelvemonkeys.imageio.util;
import com.twelvemonkeys.io.InputStreamAbstractTestCase;
import org.junit.Test;
import javax.imageio.stream.MemoryCacheImageInputStream;
import java.io.InputStream;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import static org.junit.Assert.*;
/**
* IIOInputStreamAdapter
@@ -43,14 +46,12 @@ import java.io.IOException;
* @version $Id: IIOInputStreamAdapter.java,v 1.0 Apr 11, 2008 1:04:42 PM haraldk Exp$
*/
public class IIOInputStreamAdapterTestCase extends InputStreamAbstractTestCase {
public IIOInputStreamAdapterTestCase(String name) {
super(name);
}
protected InputStream makeInputStream(byte[] pBytes) {
return new IIOInputStreamAdapter(new MemoryCacheImageInputStream(new ByteArrayInputStream(pBytes)), pBytes.length);
}
@Test
public void testReadSubstreamOpenEnd() throws IOException {
byte[] bytes = new byte[20];
@@ -74,6 +75,7 @@ public class IIOInputStreamAdapterTestCase extends InputStreamAbstractTestCase {
input.close();
}
@Test
public void testReadSubstream() throws IOException {
byte[] bytes = new byte[20];
@@ -92,6 +94,7 @@ public class IIOInputStreamAdapterTestCase extends InputStreamAbstractTestCase {
input.close();
}
@Test
public void testReadSubstreamRepositionOnClose() throws IOException {
byte[] bytes = new byte[20];
@@ -111,6 +114,7 @@ public class IIOInputStreamAdapterTestCase extends InputStreamAbstractTestCase {
input.close();
}
@Test
public void testSeekBeforeStreamNoEnd() throws IOException {
byte[] bytes = new byte[20];
@@ -124,6 +128,7 @@ public class IIOInputStreamAdapterTestCase extends InputStreamAbstractTestCase {
assertEquals(10, input.getStreamPosition());
}
@Test
public void testSeekBeforeStream() throws IOException {
byte[] bytes = new byte[20];

View File

@@ -33,6 +33,8 @@ import org.junit.Test;
import java.nio.charset.Charset;
import static org.junit.Assert.assertEquals;
/**
* JPEGSegmentTest
*

View File

@@ -79,7 +79,7 @@ import java.io.*;
* Images are stored using the "opDirectBitsRect" opcode, which directly
* stores RGB values (using PackBits run-length encoding).
*
* @author <a href="http://www.cs.hut.fi/~framling/JVG/">Kary Fr<EFBFBD>mling</a>
* @author <a href="http://www.cs.hut.fi/~framling/JVG/">Kary Främling</a>
* @author <a href="mailto:harald.kuhr@gmail.com">Harald Kuhr</a>
* @version $Id: PICTWriter.java,v 1.0 05.apr.2006 15:20:48 haku Exp$
*/