@@ -59,6 +59,14 @@ public void testConvertIntHex() throws Exception {
59
59
assertThat (ingestDocument .getFieldValue (fieldName , Integer .class ), equalTo (randomInt ));
60
60
}
61
61
62
+ public void testConvertIntLeadingZero () throws Exception {
63
+ IngestDocument ingestDocument = RandomDocumentPicks .randomIngestDocument (random ());
64
+ String fieldName = RandomDocumentPicks .addRandomField (random (), ingestDocument , "010" );
65
+ Processor processor = new ConvertProcessor (randomAlphaOfLength (10 ), fieldName , fieldName , Type .INTEGER , false );
66
+ processor .execute (ingestDocument );
67
+ assertThat (ingestDocument .getFieldValue (fieldName , Integer .class ), equalTo (10 ));
68
+ }
69
+
62
70
public void testConvertIntHexError () {
63
71
IngestDocument ingestDocument = RandomDocumentPicks .randomIngestDocument (random ());
64
72
String value = "0x" + randomAlphaOfLengthBetween (1 , 10 );
@@ -121,6 +129,14 @@ public void testConvertLongHex() throws Exception {
121
129
assertThat (ingestDocument .getFieldValue (fieldName , Long .class ), equalTo (randomLong ));
122
130
}
123
131
132
+ public void testConvertLongLeadingZero () throws Exception {
133
+ IngestDocument ingestDocument = RandomDocumentPicks .randomIngestDocument (random ());
134
+ String fieldName = RandomDocumentPicks .addRandomField (random (), ingestDocument , "010" );
135
+ Processor processor = new ConvertProcessor (randomAlphaOfLength (10 ), fieldName , fieldName , Type .LONG , false );
136
+ processor .execute (ingestDocument );
137
+ assertThat (ingestDocument .getFieldValue (fieldName , Long .class ), equalTo (10 ));
138
+ }
139
+
124
140
public void testConvertLongHexError () {
125
141
IngestDocument ingestDocument = RandomDocumentPicks .randomIngestDocument (random ());
126
142
String value = "0x" + randomAlphaOfLengthBetween (1 , 10 );
0 commit comments