### Question:
SchemaUtil { public static Optional<Field> getFieldByName(final Schema schema, final String fieldName) { if (schema.fields() != null) { for (Field field : schema.fields()) { if (field.name().equals(fieldName)) { return Optional.of(field); } else if (field.name().equals(fieldName.substring(fieldName.indexOf(".") + 1))) { return Optional.of(field); } } } return Optional.empty(); }  static Class getJavaType(final Schema schema); static Optional<Field> getFieldByName(final Schema schema, final String fieldName); static Schema getTypeSchema(final String sqlType); static int getFieldIndexByName(final Schema schema, final String fieldName); static Schema buildSchemaWithAlias(final Schema schema, final String alias); static String getSchemaFieldName(Field field); static String getJavaCastString(Schema schema); static Schema addImplicitRowTimeRowKeyToSchema(Schema schema); static Schema removeImplicitRowTimeRowKeyFromSchema(Schema schema); static Set<Integer> getRowTimeRowKeyIndexes(Schema schema); static String getSchemaDefinitionString(Schema schema); static String getSqlTypeName(Schema schema); static String buildAvroSchema(final Schema schema, String name); static Schema getAvroSerdeKsqlSchema(Schema schema); static String getFieldNameWithNoAlias(Field field); static Schema getSchemaWithNoAlias(Schema schema); static int getIndexInSchema(final String fieldName, final Schema schema); static final String ARRAY; static final String MAP; static final String ROWKEY_NAME; static final String ROWTIME_NAME; static final int ROWKEY_NAME_INDEX; }### Answer:
@Test public void shouldGetTheCorrectFieldName() { Optional<Field> field = SchemaUtil.getFieldByName(schema, "orderid".toUpperCase()); Assert.assertTrue(field.isPresent()); assertThat(field.get().schema(), sameInstance(Schema.INT64_SCHEMA)); assertThat("", field.get().name().toLowerCase(), equalTo("orderid")); Optional<Field> field1 = SchemaUtil.getFieldByName(schema, "orderid"); Assert.assertFalse(field1.isPresent()); }