### Question:
TableDesc implements Serializable { public void completeFromFields( Fields fields ) { if( !hasRequiredTableInformation() ) { List<String> names = new ArrayList<String>(); List<String> defs = new ArrayList<String>(); for( int i = 0; i < fields.size(); i++ ) { Comparable<?> cmp = fields.get( i ); names.add( cmp.toString() ); Type internalType = InternalTypeMapping.findInternalType( fields.getType( i ) ); defs.add( InternalTypeMapping.sqltypeForClass( internalType ) ); } if( columnNames == null || columnNames.length == 0 ) columnNames = names.toArray( new String[ names.size() ] ); if( columnDefs == null || columnDefs.length == 0 ) columnDefs = defs.toArray( new String[ defs.size() ] ); if( !hasRequiredTableInformation() ) throw new IllegalStateException( "could not derive TableDesc from given fields." ); } } TableDesc( String tableName ); @Deprecated  TableDesc( String tableName, String[] columnNames, String[] columnDefs, String[] primaryKeys, String tableExistsQuery );  TableDesc( String tableName, String[] columnNames, String[] columnDefs, String[] primaryKeys ); String getTableName(); String[] getColumnNames(); String[] getColumnDefs(); String[] getPrimaryKeys(); String getCreateTableStatement(); String getTableDropStatement(); boolean hasRequiredTableInformation(); void completeFromFields( Fields fields ); @Override String toString(); @Override boolean equals( Object object ); @Override int hashCode();  }### Answer:
@Test public void testCompleteFromFields() { TableDesc desc = new TableDesc( "name" ); assertFalse( desc.hasRequiredTableInformation() ); Fields fields = new Fields( "id", int.class ); desc.completeFromFields( fields ); assertTrue( desc.hasRequiredTableInformation() ); assertArrayEquals( new String[]{ "id" }, desc.getColumnNames() ); assertArrayEquals( new String[]{ "int not null" }, desc.getColumnDefs() ); }