| 23 | |
| 24 | |
| 25 | public 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); |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…