### Question:
JdbcCommon { public static String getAvroSchemaForFeedSetup (Schema schema) { if (schema == null) { return ""; } final String PIPE = "|"; final String description = ""; final String primaryKey = "0"; final String createdTracker = "0"; final String updatedTracker = "0"; final String newLine = "\n"; StringBuffer retVal = new StringBuffer(); int totalFields = schema.getFields().size(); int counter = 1; for (Schema.Field field: schema.getFields()) { String name = field.name().toLowerCase(); String dataType = field.schema().getType().name().toLowerCase(); if (dataType.equals("union")) { for (Schema fieldSchemaType: field.schema().getTypes()) { if (!fieldSchemaType.getName().toLowerCase().equals("null")) { dataType = getHiveTypeForAvroType(fieldSchemaType.getName().toLowerCase()); break; } } if (dataType.equals("union")) { dataType = "void"; } } else { dataType = getHiveTypeForAvroType(dataType); } retVal.append(name) .append(PIPE) .append(dataType) .append(PIPE) .append(description) .append(PIPE) .append(primaryKey) .append(PIPE) .append(createdTracker) .append(PIPE) .append(updatedTracker); if (counter++ < totalFields) { retVal.append(newLine); } } return retVal.toString(); }  static long convertToDelimitedStream(final ResultSet rs, final OutputStream outStream, final RowVisitor visitor, String delimiter); static long convertToAvroStream(final ResultSet rs, final OutputStream outStream, final RowVisitor visitor, final Schema schema); static Schema createSchema(final ResultSet rs); static String getAvroSchemaForFeedSetup(Schema schema);  }### Answer:
@Test public void getAvroSchemaForFeedSetupTest() { final Schema schema = SchemaBuilder .record("test_record") .namespace("my_schema") .fields() .name("po_id").type().nullable().intType().intDefault(0) .name("customer_name").type().nullable().stringType().stringDefault("null") .name("total_amount").type().nullable().stringType().stringDefault("null") .name("is_urgent").type().nullable().booleanType().booleanDefault(false) .name("last_update_time").type().nullable().stringType().stringDefault("null") .name("photo").type().nullable().bytesType().bytesDefault("null") .name("identifier").type().nullable().longType().longDefault(0) .name("state").type().stringType().stringDefault("null") .endRecord(); String obtained = JdbcCommon.getAvroSchemaForFeedSetup(schema); String expected = "po_id|int||0|0|0\n" + "customer_name|string||0|0|0\n" + "total_amount|string||0|0|0\n" + "is_urgent|boolean||0|0|0\n" + "last_update_time|string||0|0|0\n" + "photo|binary||0|0|0\n" + "identifier|bigint||0|0|0\n" + "state|string||0|0|0"; assertEquals("Avro schema not mapped correctly for feed table setup", expected, obtained); }