protected synchronized String convertNumberToString( Double number ) throws KettleValueException {
    if ( number == null ) {
      if ( !outputPaddingEnabled || length < 1 ) {
        return null;
      } else {
        // Return strings padded to the specified length...
        // This is done for backward compatibility with 2.5.x
        // We just optimized this a bit...
        //
        String[] emptyPaddedStrings = Const.getEmptyPaddedStrings();
        if ( length < emptyPaddedStrings.length ) {
          return emptyPaddedStrings[length];
        } else {
          return Const.rightPad( "", length );
        }
      }
    }

    try {
      DecimalFormat format = getDecimalFormat( false );

      // When conversion masks are different, we must ensure the number precision is not lost
      if ( this.conversionMask != null && storageMetadata != null
              && !this.conversionMask.equals( storageMetadata.getConversionMask() ) ) {
        format.setMaximumFractionDigits( 50 );
      }
      return format.format( number );
    } catch ( Exception e ) {
      throw new KettleValueException( toString() + " : couldn't convert Number to String ", e );
    }
  }
@Test
  public void testConvertNumberToString() throws KettleValueException {
    String expectedStringRepresentation = "123.123";
    Number numberToTest = Double.valueOf( "123.123" );

    ValueMetaBase base = new ValueMetaNumber( "ValueMetaNumber" );
    base.setStorageType( ValueMetaInterface.STORAGE_TYPE_NORMAL );

    ValueMetaString valueMetaString = new ValueMetaString( "ValueMetaString" );
    base.setConversionMetadata( valueMetaString );

    String convertedNumber = base.convertNumberToString( (Double) numberToTest );
    assertEquals( expectedStringRepresentation,  convertedNumber );
  }