use of com.amazon.ion.IonCatalog in project ion-java by amzn.
the class IonSystemBuilderTest method testCustomCatalog.
@Test
public void testCustomCatalog() {
IonCatalog catalog = new SimpleCatalog();
IonSystemBuilder b = IonSystemBuilder.standard().copy();
b.setCatalog(catalog);
assertSame(catalog, b.getCatalog());
IonSystem ion = b.build();
assertSame(catalog, ion.getCatalog());
}
use of com.amazon.ion.IonCatalog in project ion-java by amzn.
the class IonSystemBuilderTest method testWithCatalog.
@Test
public void testWithCatalog() {
IonCatalog catalog = new SimpleCatalog();
IonSystemBuilder b = IonSystemBuilder.standard().withCatalog(catalog);
assertSame(catalog, b.getCatalog());
}
use of com.amazon.ion.IonCatalog in project ion-java by amzn.
the class IonTextWriterBuilderTest method testCustomCatalog.
// -------------------------------------------------------------------------
@Test
public void testCustomCatalog() {
IonCatalog catalog = new SimpleCatalog();
IonTextWriterBuilder b = IonTextWriterBuilder.standard();
b.setCatalog(catalog);
assertSame(catalog, b.getCatalog());
StringBuilder out = new StringBuilder();
IonWriter writer = b.build(out);
assertSame(catalog, ((_Private_IonWriter) writer).getCatalog());
IonCatalog catalog2 = new SimpleCatalog();
b.setCatalog(catalog2);
assertSame(catalog2, b.getCatalog());
// Test with...() on mutable builder
IonTextWriterBuilder b2 = b.withCatalog(catalog);
assertSame(b, b2);
assertSame(catalog, b2.getCatalog());
// Test with...() on immutable builder
b2 = b.immutable();
assertSame(catalog, b2.getCatalog());
IonTextWriterBuilder b3 = b2.withCatalog(catalog2);
assertNotSame(b2, b3);
assertSame(catalog, b2.getCatalog());
assertSame(catalog2, b3.getCatalog());
}
use of com.amazon.ion.IonCatalog in project ion-java by amzn.
the class IonTextWriterBuilderTest method testCatalogImmutability.
@Test(expected = UnsupportedOperationException.class)
public void testCatalogImmutability() {
IonCatalog catalog = new SimpleCatalog();
IonTextWriterBuilder b = IonTextWriterBuilder.standard();
b.setCatalog(catalog);
IonTextWriterBuilder b2 = b.immutable();
assertSame(catalog, b2.getCatalog());
b2.setCatalog(null);
}
Aggregations