Search in sources :

Example 16 with IonInt

use of com.amazon.ion.IonInt in project jackson-dataformats-binary by FasterXML.

the class IonTimestampInstantSerializerTest method testSerializationWithTypeInfo02.

@Test
public void testSerializationWithTypeInfo02() throws Exception {
    IonObjectMapper mapper = newMapperBuilder().enable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS).disable(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS).addMixIn(Instant.class, MockObjectConfiguration.class).build();
    Instant date = Instant.ofEpochSecond(123456789L, 183917322);
    IonInt value = (IonInt) mapper.writeValueAsIonValue(date);
    assertEquals("The value is not correct.", 123456789183L, value.longValue());
    assertEquals("The does does not contain the expected number of annotations.", 1, value.getTypeAnnotations().length);
    assertEquals("The does does not contain the expected annotation.", Instant.class.getName(), value.getTypeAnnotations()[0]);
}
Also used : IonInt(com.amazon.ion.IonInt) Instant(java.time.Instant) IonObjectMapper(com.fasterxml.jackson.dataformat.ion.IonObjectMapper) Test(org.junit.Test)

Example 17 with IonInt

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

the class _Private_CurriedValueFactory method newInt.

public IonInt newInt(int value) {
    IonInt v = myFactory.newInt(value);
    handle(v);
    return v;
}
Also used : IonInt(com.amazon.ion.IonInt)

Example 18 with IonInt

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

the class _Private_CurriedValueFactory method newNullInt.

// -------------------------------------------------------------------------
public IonInt newNullInt() {
    IonInt v = myFactory.newNullInt();
    handle(v);
    return v;
}
Also used : IonInt(com.amazon.ion.IonInt)

Example 19 with IonInt

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

the class SymbolTableTest method testSystemIdOnNonStruct.

// -------------------------------------------------------------------------
// Testing symbols field
@Test
public void testSystemIdOnNonStruct() {
    String text = "$ion_1_0::12";
    IonInt v = (IonInt) oneValue(text);
    checkInt(12, v);
}
Also used : IonInt(com.amazon.ion.IonInt) Test(org.junit.Test)

Example 20 with IonInt

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

the class SymbolTableTest method testSymbolTableOnNonStruct.

@Test
public void testSymbolTableOnNonStruct() {
    String text = "$ion_symbol_table::12";
    IonInt v = (IonInt) oneValue(text);
    checkInt(12, v);
}
Also used : IonInt(com.amazon.ion.IonInt) Test(org.junit.Test)

Aggregations

IonInt (com.amazon.ion.IonInt)28 Test (org.junit.Test)21 IonSequence (com.amazon.ion.IonSequence)17 IonValue (com.amazon.ion.IonValue)16 IonTimestamp (com.amazon.ion.IonTimestamp)3 IonBool (com.amazon.ion.IonBool)2 IonFloat (com.amazon.ion.IonFloat)2 IonString (com.amazon.ion.IonString)2 IonStruct (com.amazon.ion.IonStruct)2 IonSymbol (com.amazon.ion.IonSymbol)2 BlobTest (com.amazon.ion.BlobTest)1 ClobTest (com.amazon.ion.ClobTest)1 IntTest (com.amazon.ion.IntTest)1 IonBlob (com.amazon.ion.IonBlob)1 IonClob (com.amazon.ion.IonClob)1 IonDecimal (com.amazon.ion.IonDecimal)1 IonList (com.amazon.ion.IonList)1 IonLob (com.amazon.ion.IonLob)1 IonNull (com.amazon.ion.IonNull)1 IonSexp (com.amazon.ion.IonSexp)1