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

Class RoundTripTest

src/test/java/com/amazon/ion/RoundTripTest.java:47–341  ·  view source on GitHub ↗

Processes all text files in the "good" suite, transforming between text and binary twice to ensure that the process is equivalent. TODO amazon-ion/ion-java/issues/29 Refactor this test class, possible duplicate test coverage in RoundTripStreamingTest.

Source from the content-addressed store, hash-verified

45 * {@link RoundTripStreamingTest}.
46 */
47public class RoundTripTest
48 extends IonTestCase
49{
50 // TODO amazon-ion/ion-java/issues/27 Writing IonSymbol to bytes using IonSymbol.writeTo(IonWriter)
51 // will throw UnknownSymbolException if symbol text is unknown
52 public static final FilenameFilter ROUND_TRIP_TEST_SKIP_LIST =
53 new FileIsNot("good/symbols.ion");
54
55 /**
56 * Enumeration of the different ways a materialized IonValue can be
57 * serialized (encoded) into binary Ion format.
58 */
59 private enum BinaryEncoderType
60 {
61 DATAGRAM_GET_BYTES,
62 VALUE_WRITETO_WRITER,
63 WRITER_WRITEVALUES_READER
64 }
65
66 /**
67 * We don't use binary files since some of those have non-canonical
68 * encodings that won't round-trip.
69 */
70 @Inject("testFile")
71 public static final File[] FILES = testdataFiles(new And(TEXT_ONLY_FILTER, GLOBAL_SKIP_LIST, ROUND_TRIP_TEST_SKIP_LIST), GOOD_IONTESTS_FILES);
72
73 @Inject("copySpeed")
74 public static final StreamCopySpeed[] STREAM_COPY_SPEEDS =
75 StreamCopySpeed.values();
76
77 @Inject("binaryEncoderType")
78 public static final BinaryEncoderType[] BINARY_ENCODER_TYPES =
79 BinaryEncoderType.values();
80
81 private StringBuilder myBuilder;
82 private File myTestFile;
83 private BinaryEncoderType myBinaryEncoderType;
84
85 public void setTestFile(File file)
86 {
87 myTestFile = file;
88 }
89
90 public void setBinaryEncoderType(BinaryEncoderType type)
91 {
92 myBinaryEncoderType = type;
93 }
94
95 @Override
96 @Before
97 public void setUp()
98 throws Exception
99 {
100 super.setUp();
101 myBuilder = new StringBuilder();
102 }
103
104 @Override

Callers

nothing calls this directly

Calls 2

testdataFilesMethod · 0.80
valuesMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…