### Question:
GrokSchemaBuilder { public static Schema buildSchemaForGrok(final List<GrokMatcher> patterns) { SchemaBuilder schema = SchemaBuilder.struct(); patterns.forEach(grok -> buildSchemaForGrok(schema, grok)); return schema.build(); }  static Schema buildSchemaForGrok(final List<GrokMatcher> patterns); static String getStringFieldName(final NameEntry e);  }### Answer:
@Test public void test() { final GrokPatternCompiler compiler = new GrokPatternCompiler(new GrokPatternResolver(), true); final GrokMatcher matcher = compiler.compile(GROK_PATTERN); Schema schema = buildSchemaForGrok(Collections.singletonList(matcher)); List<Field> fields = schema.schema().fields(); Assert.assertEquals(3, fields.size()); Assert.assertEquals("timestamp", fields.get(0).name()); Assert.assertEquals("level", fields.get(1).name()); Assert.assertEquals("message", fields.get(2).name()); }