diff options
Diffstat (limited to 'tests/src/cgeo/geocaching/files/ProgressInputStreamTest.java')
| -rw-r--r-- | tests/src/cgeo/geocaching/files/ProgressInputStreamTest.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/src/cgeo/geocaching/files/ProgressInputStreamTest.java b/tests/src/cgeo/geocaching/files/ProgressInputStreamTest.java new file mode 100644 index 0000000..e2ef2ba --- /dev/null +++ b/tests/src/cgeo/geocaching/files/ProgressInputStreamTest.java @@ -0,0 +1,22 @@ +package cgeo.geocaching.files; + +import org.apache.commons.io.IOUtils; + +import junit.framework.TestCase; + +public class ProgressInputStreamTest extends TestCase { + + public static void testRead() throws Exception { + ProgressInputStream stream = new ProgressInputStream(IOUtils.toInputStream("test")); + assertEquals(0, stream.getProgress()); + + int bytesRead = 0; + while (stream.read() >= 0 && bytesRead < 10000) { + bytesRead++; + } + assertEquals(4, bytesRead); + assertEquals(4, stream.getProgress()); + IOUtils.closeQuietly(stream); + } + +} |
