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

Class IonTestCase

src/test/java/com/amazon/ion/IonTestCase.java:46–1140  ·  view source on GitHub ↗

Base class with helpers for Ion unit tests.

Source from the content-addressed store, hash-verified

44 * Base class with helpers for Ion unit tests.
45 */
46@RunWith(Injected.class)
47public abstract class IonTestCase
48 extends Assert
49{
50 private static final File ION_TESTS_PATH = new File("ion-tests");
51 private static final File ION_TESTS_IONTESTDATA_PATH = new File(ION_TESTS_PATH, "iontestdata");
52 private static final File ION_TESTS_BULK_PATH = new File(ION_TESTS_PATH, "bulk");
53
54 static
55 {
56 if (!ION_TESTS_IONTESTDATA_PATH.exists())
57 {
58 throw new RuntimeException("Cannot locate test data directory.");
59 }
60 }
61
62 protected enum StreamingMode {
63 NEW_STREAMING() {
64 @Override
65 public IonReaderBuilder getReaderBuilder() {
66 return IonReaderBuilder.standard();
67 }
68 },
69 NEW_STREAMING_INCREMENTAL() {
70 @Override
71 public IonReaderBuilder getReaderBuilder() {
72 return IonReaderBuilder.standard().withIncrementalReadingEnabled(true);
73 }
74 };
75
76 public abstract IonReaderBuilder getReaderBuilder();
77
78 public final IonReader newIonReader(IonCatalog catalog, InputStream inputStream) {
79 return getReaderBuilder().withCatalog(catalog).build(inputStream);
80 }
81
82 public final IonReader newIonReader(IonCatalog catalog, byte[] data) {
83 return getReaderBuilder().withCatalog(catalog).build(data);
84 }
85 }
86
87 // Using an enum makes the test names more understandable than a boolean.
88 protected enum StreamCopySpeed { COPY_OPTIMIZED, COPY_NON_OPTIMIZED }
89
90 @Inject("streamingMode")
91 public static final StreamingMode[] STREAMING_DIMENSION = StreamingMode.values();
92
93 /**
94 * Flag on whether IonSystems generated is
95 * {@link IonSystemBuilder#isStreamCopyOptimized()}.
96 * <p>
97 * This is false by default. Keep this in sync with {@link IonSystemBuilder}!
98 */
99 private boolean myStreamCopyOptimized = false;
100 private StreamingMode myStreamingMode;
101
102 private static boolean ourSystemPropertiesLoaded = false;
103 protected SimpleCatalog myCatalog;

Callers

nothing calls this directly

Calls 1

valuesMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…