default Object convertToTestOutput(Object data, TestType dataType) { if (data == null || dataType instanceof UnknownTestType) { return getNullData(); } else if (dataType instanceof IntegerTestType) { return getIntegerData((Integer) data); } else if (dataType instanceof LongTestType) { return getLongData((Long) data); } else if (dataType instanceof BooleanTestType) { return getBooleanData((Boolean) data); } else if (dataType instanceof StringTestType) { return getStringData((String) data); } else if (dataType instanceof ArrayTestType) { return getArrayData((List<Object>) data, ((ArrayTestType) dataType).getElementType()); } else if (dataType instanceof MapTestType) { return getMapData((Map<Object, Object>) data, ((MapTestType) dataType).getKeyType(), ((MapTestType) dataType).getValueType()); } else if (dataType instanceof StructTestType) { return getStructData((Row) data, ((StructTestType) dataType).getFieldTypes(), ((StructTestType) dataType).getFieldNames()); } else { throw new UnsupportedOperationException("Unsupported data type: " + dataType.getClass()); } }
default Object convertToTestOutput(Object data, TestType dataType) { if (data == null || dataType instanceof UnknownTestType) { return getNullData(); } else if (dataType instanceof IntegerTestType) { return getIntegerData((Integer) data); } else if (dataType instanceof LongTestType) { return getLongData((Long) data); } else if (dataType instanceof BooleanTestType) { return getBooleanData((Boolean) data); } else if (dataType instanceof StringTestType) { return getStringData((String) data); } else if (dataType instanceof ArrayTestType) { return getArrayData((List<Object>) data, ((ArrayTestType) dataType).getElementType()); } else if (dataType instanceof MapTestType) { return getMapData((Map<Object, Object>) data, ((MapTestType) dataType).getKeyType(), ((MapTestType) dataType).getValueType()); } else if (dataType instanceof StructTestType) { return getStructData((Row) data, ((StructTestType) dataType).getFieldTypes(), ((StructTestType) dataType).getFieldNames()); } else { throw new UnsupportedOperationException("Unsupported data type: " + dataType.getClass()); } }