@Test public void testConvertToStringInvalid() { InPlaceUuidValueEditor editor = new InPlaceUuidValueEditor(); byte[] bytes = new byte[] { ( byte ) 0x00, ( byte ) 0x11, ( byte ) 0x22, ( byte ) 0x33 }; String displayValue = editor.convertToString( bytes ); assertEquals( Messages.getString( "InPlaceUuidValueEditor.InvalidUuid" ), displayValue ); byte[] bytes2 = new byte[] { ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, }; String displayValue2 = editor.convertToString( bytes2 ); assertEquals( Messages.getString( "InPlaceUuidValueEditor.InvalidUuid" ), displayValue2 ); }
String convertToString( byte[] bytes ) { if ( bytes == null || bytes.length != 16 ) { return Messages.getString( "InPlaceUuidValueEditor.InvalidUuid" ); } char[] hex = Hex.encodeHex( bytes ); StringBuffer sb = new StringBuffer(); sb.append( hex, 0, 8 ); sb.append( '-' ); sb.append( hex, 8, 4 ); sb.append( '-' ); sb.append( hex, 12, 4 ); sb.append( '-' ); sb.append( hex, 16, 4 ); sb.append( '-' ); sb.append( hex, 20, 12 ); return Strings.toLowerCase( sb.toString() ); }
InPlaceUuidValueEditor extends HexValueEditor { String convertToString( byte[] bytes ) { if ( bytes == null || bytes.length != 16 ) { return Messages.getString( "InPlaceUuidValueEditor.InvalidUuid" ); } char[] hex = Hex.encodeHex( bytes ); StringBuffer sb = new StringBuffer(); sb.append( hex, 0, 8 ); sb.append( '-' ); sb.append( hex, 8, 4 ); sb.append( '-' ); sb.append( hex, 12, 4 ); sb.append( '-' ); sb.append( hex, 16, 4 ); sb.append( '-' ); sb.append( hex, 20, 12 ); return Strings.toLowerCase( sb.toString() ); } }
InPlaceUuidValueEditor extends HexValueEditor { String convertToString( byte[] bytes ) { if ( bytes == null || bytes.length != 16 ) { return Messages.getString( "InPlaceUuidValueEditor.InvalidUuid" ); } char[] hex = Hex.encodeHex( bytes ); StringBuffer sb = new StringBuffer(); sb.append( hex, 0, 8 ); sb.append( '-' ); sb.append( hex, 8, 4 ); sb.append( '-' ); sb.append( hex, 12, 4 ); sb.append( '-' ); sb.append( hex, 16, 4 ); sb.append( '-' ); sb.append( hex, 20, 12 ); return Strings.toLowerCase( sb.toString() ); }  }
InPlaceUuidValueEditor extends HexValueEditor { String convertToString( byte[] bytes ) { if ( bytes == null || bytes.length != 16 ) { return Messages.getString( "InPlaceUuidValueEditor.InvalidUuid" ); } char[] hex = Hex.encodeHex( bytes ); StringBuffer sb = new StringBuffer(); sb.append( hex, 0, 8 ); sb.append( '-' ); sb.append( hex, 8, 4 ); sb.append( '-' ); sb.append( hex, 12, 4 ); sb.append( '-' ); sb.append( hex, 16, 4 ); sb.append( '-' ); sb.append( hex, 20, 12 ); return Strings.toLowerCase( sb.toString() ); }  String getDisplayValue( IValue value ); }
InPlaceUuidValueEditor extends HexValueEditor { String convertToString( byte[] bytes ) { if ( bytes == null || bytes.length != 16 ) { return Messages.getString( "InPlaceUuidValueEditor.InvalidUuid" ); } char[] hex = Hex.encodeHex( bytes ); StringBuffer sb = new StringBuffer(); sb.append( hex, 0, 8 ); sb.append( '-' ); sb.append( hex, 8, 4 ); sb.append( '-' ); sb.append( hex, 12, 4 ); sb.append( '-' ); sb.append( hex, 16, 4 ); sb.append( '-' ); sb.append( hex, 20, 12 ); return Strings.toLowerCase( sb.toString() ); }  String getDisplayValue( IValue value );  }