--- /dev/null
+package org.marc4j.test;\r
+\r
+import java.io.InputStream;\r
+import java.util.zip.GZIPInputStream;\r
+\r
+import junit.framework.Test;\r
+import junit.framework.TestCase;\r
+import junit.framework.TestSuite;\r
+import junit.textui.TestRunner;\r
+\r
+import org.marc4j.MarcReader;\r
+import org.marc4j.MarcStreamReader;\r
+import org.marc4j.marc.Record;\r
+\r
+public class GzipRecordTest extends TestCase {\r
+\r
+ Record record = null;\r
+\r
+ public void testGzipRecordRead() throws Exception {\r
+ InputStream input = getClass().getResourceAsStream(\r
+ "resources/oais.26.mrc.gz");\r
+ assertTrue("No test data", input != null);\r
+ GZIPInputStream gzipped = new GZIPInputStream(input);\r
+ MarcReader reader = new MarcStreamReader(gzipped, "MARC-8");\r
+ int index = 0;\r
+ while (reader.hasNext()) {\r
+ record = reader.next();\r
+ ++index;\r
+ }\r
+ assertTrue("Number of records was not correct: " + index, index == 60221); \r
+ input.close();\r
+ }\r
+\r
+ public void tearDown() {\r
+ record = null;\r
+ }\r
+\r
+ public static Test suite() {\r
+ return new TestSuite(GzipRecordTest.class);\r
+ }\r
+\r
+ public static void main(String args[]) {\r
+ TestRunner.run(suite());\r
+ }\r
+}\r