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

Class IonValueChecker

src/test/java/com/amazon/ion/IonValueChecker.java:25–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23
24
25public class IonValueChecker
26 implements Checker
27{
28 private IonValue myCurrentValue;
29
30 public IonValueChecker(IonValue value)
31 {
32 myCurrentValue = value;
33 }
34
35
36 public IonValueChecker fieldName(String expectedText, int expectedSid)
37 {
38 if (expectedText == null)
39 {
40 try
41 {
42 myCurrentValue.getFieldName();
43 fail("Expected " + UnknownSymbolException.class);
44 }
45 catch (UnknownSymbolException e)
46 {
47 assertEquals(expectedSid, e.getSid());
48 }
49 }
50 else
51 {
52 assertEquals("IonValue.getFieldName()",
53 expectedText, myCurrentValue.getFieldName());
54 }
55
56 assertEquals("IonValue.getFieldId",
57 expectedSid, myCurrentValue.getFieldId());
58
59 SymbolToken sym = myCurrentValue.getFieldNameSymbol();
60 checkSymbol(expectedText, expectedSid, sym);
61
62 return this;
63 }
64
65
66 public IonValueChecker annotation(String expectedText)
67 {
68 String[] typeAnnotations = myCurrentValue.getTypeAnnotations();
69 assertEquals(expectedText, typeAnnotations[0]);
70
71 return this;
72 }
73
74
75 public IonValueChecker annotation(String expectedText, int expectedSid)
76 {
77 if (expectedText == null)
78 {
79 try
80 {
81 myCurrentValue.getTypeAnnotations();
82 fail("Expected " + UnknownSymbolException.class);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…