Search in sources :

Example 6 with UnknownSymbolException

use of com.amazon.ion.UnknownSymbolException in project ion-java by amzn.

the class IonAssert method checkSymbol.

/**
 * @param expectedText null means absent
 */
public static void checkSymbol(IonReader in, String expectedText, int expectedSid) {
    assertSame(IonType.SYMBOL, in.getType());
    assertFalse(in.isNullValue());
    if (expectedText == null) {
        try {
            in.stringValue();
            fail("Expected " + UnknownSymbolException.class);
        } catch (UnknownSymbolException e) {
            assertEquals(expectedSid, e.getSid());
        }
    } else {
        assertEquals("IonReader.stringValue()", expectedText, in.stringValue());
    }
    SymbolToken sym = in.symbolValue();
    IonTestCase.checkSymbol(expectedText, expectedSid, sym);
}
Also used : UnknownSymbolException(com.amazon.ion.UnknownSymbolException) SymbolToken(com.amazon.ion.SymbolToken)

Aggregations

UnknownSymbolException (com.amazon.ion.UnknownSymbolException)6 IonValue (com.amazon.ion.IonValue)2 SymbolToken (com.amazon.ion.SymbolToken)2 SymbolTable (com.amazon.ion.SymbolTable)1 IntList (com.amazon.ion.impl.bin.IntList)1 Test (org.junit.Test)1