MCPcopy Create free account
hub / github.com/amazon-ion/ion-java / GoodIonTest

Class GoodIonTest

src/test/java/com/amazon/ion/GoodIonTest.java:31–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29import org.junit.Test;
30
31public class GoodIonTest
32 extends IonTestCase
33{
34 @Inject("testFile")
35 public static final File[] FILES = testdataFiles(GLOBAL_SKIP_LIST, GOOD_IONTESTS_FILES);
36
37 private File myTestFile;
38 private boolean myFileIsBinary;
39
40 public void setTestFile(File file)
41 {
42 myTestFile = file;
43
44 String fileName = file.getName();
45 myFileIsBinary = fileName.endsWith(".10n");
46 }
47
48
49 @Test
50 public void test()
51 throws Exception
52 {
53 if (myTestFile.getName().startsWith("__")) {
54 System.out.println("debug file encountered: "+myTestFile.getName());
55 }
56
57 // Pass 1: Use Loader to read the data
58 IonDatagram datagram = load(myTestFile);
59
60 // Pass 2: Use IonReader
61 IonReader treeReader = system().newReader(datagram);
62
63 FileInputStream in = new FileInputStream(myTestFile);
64 try {
65 IonReader fileReader = getStreamingMode().newIonReader(system().getCatalog(), in);
66
67 ReaderCompare.compare(treeReader, fileReader);
68 }
69 finally {
70 in.close();
71 }
72
73
74 // Pass 3: Use Iterator over InputStream
75 in = new FileInputStream(myTestFile);
76 try {
77 Iterator<IonValue> expected = datagram.iterator();
78 Iterator<IonValue> actual = system().iterate(in);
79
80 assertIonIteratorEquals(expected, actual);
81 }
82 finally {
83 in.close();
84 }
85
86 // Pass 4: Use Iterator over IonReader
87 in = new FileInputStream(myTestFile);
88 try {

Callers

nothing calls this directly

Calls 1

testdataFilesMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…