### Question:
SchemaToJsonMapper { public static String getCreateTableStatementFromJson( @NonNull String json, boolean createPrimaryKey, boolean addDefaultValueDefinition, @NonNull String schemaName, String tableName, String storeName ) { JsonTable table = gson.fromJson( json, JsonTable.class ); SqlWriter writer = new SqlPrettyWriter( PolyphenyDbSqlDialect.DEFAULT, true, null ); writer.keyword( "CREATE TABLE" ); SqlWriter.Frame identifierFrame = writer.startList( SqlWriter.FrameTypeEnum.IDENTIFIER ); writer.identifier( schemaName ); writer.sep( ".", true ); if ( tableName != null ) { writer.identifier( tableName ); } else { writer.identifier( table.tableName ); } writer.endList( identifierFrame ); SqlWriter.Frame columnFrame = writer.startList( "(", ")" ); for ( JsonColumn column : table.columns ) { writer.sep( "," ); writer.identifier( column.columnName ); writer.keyword( column.type ); if ( column.length != null ) { SqlWriter.Frame columnTypeFrame = writer.startList( SqlWriter.FrameTypeEnum.FUN_CALL, "(", ")" ); writer.print( column.length ); if ( column.scale != null ) { writer.sep( ",", true ); writer.print( column.scale ); } writer.endList( columnTypeFrame ); } if ( !column.nullable ) { writer.keyword( "NOT NULL" ); } if ( addDefaultValueDefinition ) { if ( column.defaultValue != null ) { writer.keyword( "DEFAULT" ); if ( Arrays.asList( PolyType.VARCHAR.name(), PolyType.DATE.name(), PolyType.TIME.name(), PolyType.TIMESTAMP.name() ).contains( column.type ) ) { writer.literal( "'" + column.defaultValue + "'" ); } else { writer.literal( column.defaultValue ); } } else if ( column.defaultFunctionName != null ) { writer.keyword( "DEFAULT" ); writer.print( column.defaultFunctionName ); } } } if ( createPrimaryKey && table.primaryKeyColumnNames != null ) { writer.sep( "," ); writer.keyword( "PRIMARY KEY" ); SqlWriter.Frame primaryKeyFrame = writer.startList( SqlWriter.FrameTypeEnum.FUN_CALL, "(", ")" ); for ( String columnName : table.primaryKeyColumnNames ) { writer.sep( "," ); writer.identifier( columnName ); } writer.endList( primaryKeyFrame ); } writer.endList( columnFrame ); if ( storeName != null ) { writer.keyword( "ON STORE" ); writer.identifier( storeName ); } return writer.toSqlString().getSql(); }  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:
@Test public void getStatementTest() { String statement = SchemaToJsonMapper.getCreateTableStatementFromJson( mockJson, true, true, "foo", null, "hsqldb1" ); final String expected1 = "CREATE TABLE \"foo\".\"stores\" (\"sid\" INTEGER NOT NULL, \"name\" VARCHAR(50) NOT NULL, \"location\" VARCHAR(30) DEFAULT 'Basel', PRIMARY KEY(\"sid\", \"name\")) ON STORE \"hsqldb1\""; Assert.assertEquals( statement, expected1 ); statement = SchemaToJsonMapper.getCreateTableStatementFromJson( mockJson, false, false, "foo", null, null ); final String expected2 = "CREATE TABLE \"foo\".\"stores\" (\"sid\" INTEGER NOT NULL, \"name\" VARCHAR(50) NOT NULL, \"location\" VARCHAR(30))"; Assert.assertEquals( statement, expected2 ); statement = SchemaToJsonMapper.getCreateTableStatementFromJson( mockJson, false, false, "foo", "bar", null ); final String expected3 = "CREATE TABLE \"foo\".\"bar\" (\"sid\" INTEGER NOT NULL, \"name\" VARCHAR(50) NOT NULL, \"location\" VARCHAR(30))"; Assert.assertEquals( statement, expected3 ); }