### Question:
SchemaToJsonMapper { public static String exportTableDefinitionAsJson( @NonNull CatalogTable catalogTable, boolean exportPrimaryKey, boolean exportDefaultValues ) { List<JsonColumn> columns = new LinkedList<>(); for ( CatalogColumn catalogColumn : Catalog.getInstance().getColumns( catalogTable.id ) ) { String defaultValue = null; String defaultFunctionName = null; if ( exportDefaultValues ) { if ( catalogColumn.defaultValue != null ) { defaultValue = catalogColumn.defaultValue.value; defaultFunctionName = catalogColumn.defaultValue.functionName; } } columns.add( new JsonColumn( catalogColumn.name, catalogColumn.type.name(), catalogColumn.length, catalogColumn.scale, catalogColumn.nullable, defaultValue, defaultFunctionName ) ); } List<String> primaryKeyColumnNames = null; if ( exportPrimaryKey ) { for ( CatalogKey catalogKey : Catalog.getInstance().getTableKeys( catalogTable.id ) ) { if ( catalogKey.id == catalogTable.primaryKey ) { primaryKeyColumnNames = catalogKey.getColumnNames(); break; } } } JsonTable table = new JsonTable( catalogTable.name, columns, primaryKeyColumnNames ); return gson.toJson( table ); }  static String exportTableDefinitionAsJson( @NonNull CatalogTable catalogTable, boolean exportPrimaryKey, boolean exportDefaultValues ); static String getTableNameFromJson( @NonNull String json ); static String getCreateTableStatementFromJson( @NonNull String json, boolean createPrimaryKey, boolean addDefaultValueDefinition, @NonNull String schemaName, String tableName, String storeName );  }### Answer:
@Ignore @Test public void exportTest() { CatalogTable catalogTable = new CatalogTable( 4, "stores", ImmutableList.of(), 1, 1, 1, "hans", TableType.TABLE, "", 23L, ImmutableMap.of() ); Catalog catalog = Catalog.getInstance(); Arrays.asList( new CatalogColumn( 5, "sid", 4, 1, 1, 1, PolyType.INTEGER, null, null, null, null, null, false, null, null ), new CatalogColumn( 6, "name", 4, 1, 1, 2, PolyType.VARCHAR, null, 50, null, null, null, false, null, null ), new CatalogColumn( 7, "location", 4, 1, 1, 3, PolyType.VARCHAR, null, 30, null, null, null, true, null, new CatalogDefaultValue( 7, PolyType.VARCHAR, "Basel", null ) ) ); new CatalogSchema( 1, "public", 1, 1, "hans", SchemaType.RELATIONAL ); new CatalogDatabase( 1, "APP", 1, "hans", 1L, "public" ); new CatalogUser( 1, "hans", "secrete" ); new HashMap<>(); new HashMap<>(); Arrays.asList( new CatalogKey( 23L, 4, 1, 1, Arrays.asList( 5L, 6L ) ), new CatalogKey( 24L, 4, 1, 1, Arrays.asList( 6L ) ) ); String json = SchemaToJsonMapper.exportTableDefinitionAsJson( catalogTable, true, true ); Assert.assertEquals( json, mockJson ); }