public static <U extends Enum<U> & PhysicalUnit>  Quantity<U> fromString(String valueString, U defaultUnit) {
		if(valueString == null)
			return null;
		final int separatorPosition = valueString.lastIndexOf(' ');
		final String numberString;
		final U unit;
		if(separatorPosition >= 0){
			numberString = valueString.substring(0, separatorPosition);
			String unitString = valueString.substring(separatorPosition + 1);
			final Class<U> unitClass = defaultUnit.getDeclaringClass();
			unit = Enum.valueOf(unitClass, unitString);
		}
		else {
			numberString = valueString;
			unit = defaultUnit;
		}
		try {
            double doubleValue = ROUNDING_FORMAT.parse(numberString).doubleValue();
            return new Quantity<U>(doubleValue, unit);
        } catch (ParseException e) {
            throw new NumberFormatException("Invalid number " + numberString);
        }
	}
@Test
    public void fromNullString() throws Exception {
        Quantity<Metrics> quantity = Quantity.fromString(null, Metrics.cm);
        assertNull(quantity);
    }