@@ -59,6 +59,14 @@ public void testConvertIntHex() throws Exception {
5959 assertThat (ingestDocument .getFieldValue (fieldName , Integer .class ), equalTo (randomInt ));
6060 }
6161
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+
6270 public void testConvertIntHexError () {
6371 IngestDocument ingestDocument = RandomDocumentPicks .randomIngestDocument (random ());
6472 String value = "0x" + randomAlphaOfLengthBetween (1 , 10 );
@@ -121,6 +129,14 @@ public void testConvertLongHex() throws Exception {
121129 assertThat (ingestDocument .getFieldValue (fieldName , Long .class ), equalTo (randomLong ));
122130 }
123131
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+
124140 public void testConvertLongHexError () {
125141 IngestDocument ingestDocument = RandomDocumentPicks .randomIngestDocument (random ());
126142 String value = "0x" + randomAlphaOfLengthBetween (1 , 10 );
0 commit comments