### Question:
HypersonicDatabaseMeta extends BaseDatabaseMeta implements IDatabase { @Override public String getFieldDefinition( IValueMeta v, String tk, String pk, boolean useAutoinc, boolean addFieldname, boolean addCr ) { StringBuilder retval = new StringBuilder( 128 ); String fieldname = v.getName(); int length = v.getLength(); int precision = v.getPrecision(); if ( addFieldname ) { retval.append( fieldname ).append( ' ' ); } int type = v.getType(); switch ( type ) { case IValueMeta.TYPE_TIMESTAMP: case IValueMeta.TYPE_DATE: retval.append( "TIMESTAMP" ); break; case IValueMeta.TYPE_BOOLEAN: if ( supportsBooleanDataType() ) { retval.append( "BOOLEAN" ); } else { retval.append( "CHAR(1)" ); } break; case IValueMeta.TYPE_NUMBER: case IValueMeta.TYPE_INTEGER: case IValueMeta.TYPE_BIGNUMBER: if ( fieldname.equalsIgnoreCase( tk ) || fieldname.equalsIgnoreCase( pk ) ) { retval.append( "BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 0, INCREMENT BY 1) PRIMARY KEY" ); } else { if ( length > 0 ) { if ( precision > 0 || length > 18 ) { retval.append( "NUMERIC(" ).append( length ).append( ", " ).append( precision ).append( ')' ); } else { if ( length > 9 ) { retval.append( "BIGINT" ); } else { if ( length < 5 ) { retval.append( "SMALLINT" ); } else { retval.append( "INTEGER" ); } } } } else { retval.append( "DOUBLE PRECISION" ); } } break; case IValueMeta.TYPE_STRING: if ( length >= DatabaseMeta.CLOB_LENGTH ) { retval.append( "LONGVARCHAR" ); } else { retval.append( "VARCHAR" ); if ( length > 0 ) { retval.append( '(' ).append( length ); } else { retval.append( '(' ); } retval.append( ')' ); } break; default: retval.append( " UNKNOWN" ); break; } if ( addCr ) { retval.append( Const.CR ); } return retval.toString(); }  @Override int[] getAccessTypeList(); @Override int getDefaultDatabasePort(); @Override String getDriverClass(); @Override String getURL(String hostname, String port, String databaseName); @Override boolean supportsBitmapIndex(); @Override String getAddColumnStatement( String tablename, IValueMeta v, String tk, boolean useAutoinc,
                                       String pk, boolean semicolon ); @Override String getModifyColumnStatement( String tablename, IValueMeta v, String tk, boolean useAutoinc,
                                          String pk, boolean semicolon ); @Override String getFieldDefinition( IValueMeta v, String tk, String pk, boolean useAutoinc,
                                    boolean addFieldname, boolean addCr ); @Override String getExtraOptionsHelpText(); @Override String[] getReservedWords(); @Override boolean supportsSequences(); @Override String getSqlSequenceExists( String sequenceName ); @Override String getSqlListOfSequences(); @Override String getSqlCurrentSequenceValue( String sequenceName ); @Override String getSqlNextSequenceValue( String sequenceName );  }### Answer:
@Test public void testGetFieldDefinition() throws Exception { IValueMeta vm = new ValueMetaString(); String sql = hypersonicDatabaseMeta.getFieldDefinition( vm, null, null, false, false, false ); String expectedSql = "VARCHAR()"; assertEquals( "Check PDI-11461 without length", expectedSql, sql ); vm.setLength( DatabaseMeta.CLOB_LENGTH - 1 ); sql = hypersonicDatabaseMeta.getFieldDefinition( vm, null, null, false, false, false ); expectedSql = "VARCHAR(" + ( DatabaseMeta.CLOB_LENGTH - 1 ) + ")"; assertEquals( "Check PDI-11461 with length", expectedSql, sql ); vm.setLength( DatabaseMeta.CLOB_LENGTH ); sql = hypersonicDatabaseMeta.getFieldDefinition( vm, null, null, false, false, false ); expectedSql = "LONGVARCHAR"; assertEquals( "Check PDI-11461 with clob/text length", expectedSql, sql ); }