Search in sources :

Example 11 with Span

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

the class FacetsTest method assumeFacetThrowsOnNullFacted.

@Test(expected = UnsupportedFacetException.class)
public void assumeFacetThrowsOnNullFacted() {
    Faceted subject = null;
    // We want this assignment idiom to work
    @SuppressWarnings("unused") Span n = assumeFacet(Span.class, subject);
}
Also used : Span(com.amazon.ion.Span) Test(org.junit.Test)

Example 12 with Span

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

the class FacetsTest method assumeFacetThrowsOnNullObject.

@Test(expected = UnsupportedFacetException.class)
public void assumeFacetThrowsOnNullObject() {
    Object subject = null;
    // We want this assignment idiom to work
    @SuppressWarnings("unused") Span n = assumeFacet(Span.class, subject);
}
Also used : Span(com.amazon.ion.Span) Test(org.junit.Test)

Example 13 with Span

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

the class NonOffsetSpanReaderTest method noOffsetSpanFacet.

@Test
public void noOffsetSpanFacet() {
    read("null");
    in.next();
    if (sp != null) {
        Span s = sp.currentSpan();
        expectNoFacet(OffsetSpan.class, s);
    }
}
Also used : Span(com.amazon.ion.Span) OffsetSpan(com.amazon.ion.OffsetSpan) Test(org.junit.Test)

Example 14 with Span

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

the class NonTextSpanTest method noTextSpanFacet.

@Test
public void noTextSpanFacet() {
    read("null");
    in.next();
    if (sp != null) {
        Span s = sp.currentSpan();
        expectNoFacet(TextSpan.class, s);
    }
}
Also used : TextSpan(com.amazon.ion.TextSpan) Span(com.amazon.ion.Span) Test(org.junit.Test)

Example 15 with Span

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

the class ReaderFacetTestCase method checkCurrentSpan.

protected void checkCurrentSpan(long start, long finish) {
    Span span = sp.currentSpan();
    OffsetSpan offsets = assumeFacet(OffsetSpan.class, span);
    checkSpan(start, finish, offsets);
    offsets = currentSpan(OffsetSpan.class, in);
    checkSpan(start, finish, offsets);
}
Also used : OffsetSpan(com.amazon.ion.OffsetSpan) TextSpan(com.amazon.ion.TextSpan) Spans.currentSpan(com.amazon.ion.util.Spans.currentSpan) Span(com.amazon.ion.Span) OffsetSpan(com.amazon.ion.OffsetSpan)

Aggregations

Span (com.amazon.ion.Span)19 Test (org.junit.Test)14 TextSpan (com.amazon.ion.TextSpan)4 IonType (com.amazon.ion.IonType)3 OffsetSpan (com.amazon.ion.OffsetSpan)3 Spans.currentSpan (com.amazon.ion.util.Spans.currentSpan)3 IonDatagram (com.amazon.ion.IonDatagram)2 SpanProvider (com.amazon.ion.SpanProvider)1 File (java.io.File)1