1 package org.marc4j.test;
\r
3 import java.io.InputStream;
\r
4 import java.util.zip.GZIPInputStream;
\r
6 import junit.framework.Test;
\r
7 import junit.framework.TestCase;
\r
8 import junit.framework.TestSuite;
\r
9 import junit.textui.TestRunner;
\r
11 import org.marc4j.MarcReader;
\r
12 import org.marc4j.MarcStreamReader;
\r
13 import org.marc4j.marc.Record;
\r
15 public class GzipRecordTest extends TestCase {
\r
17 Record record = null;
\r
19 public void testGzipRecordRead() throws Exception {
\r
20 InputStream input = getClass().getResourceAsStream(
\r
21 "resources/brkrtest.mrc.gz");
\r
22 assertTrue("No test data", input != null);
\r
23 GZIPInputStream gzipped = new GZIPInputStream(input);
\r
24 MarcReader reader = new MarcStreamReader(gzipped, "MARC-8");
\r
26 while (reader.hasNext()) {
\r
27 record = reader.next();
\r
30 assertTrue("Number of records was not correct: " + index, index == 8);
\r
34 public void tearDown() {
\r
38 public static Test suite() {
\r
39 return new TestSuite(GzipRecordTest.class);
\r
42 public static void main(String args[]) {
\r
43 TestRunner.run(suite());
\r