Quantity implements Serializable { @Override public String toString() { StringBuilder b = new StringBuilder(); if (getAmount() != null) { b.append(getAmount()); } if (getFormat() != null) { b.append(getFormat()); } return b.toString(); } Quantity();  Quantity(String amount);  Quantity(String amount, String format); String getAmount(); void setAmount(String amount); String getFormat(); void setFormat(String format); static BigDecimal getAmountInBytes(Quantity quantity); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static Quantity parse(String quantityAsString); @JsonAnyGetter Map<String, Object> getAdditionalProperties(); @JsonAnySetter void setAdditionalProperty(String name, Object value);  }
@Test @DisplayName("Test toString() method") public void testStringConversion() { assertEquals(".5Mi", new Quantity(".5Mi").toString()); assertEquals("1", new Quantity("1").toString()); assertEquals("129e6", new Quantity("129e6").toString()); assertEquals("0.001m", new Quantity("0.001m").toString()); assertEquals("1Ki", new Quantity("1Ki").toString()); assertEquals("32Mi", new Quantity("32Mi").toString()); assertEquals("1e3", new Quantity("1e3").toString()); assertEquals("1e-3", new Quantity("1e-3").toString()); assertEquals("100k", new Quantity("100k").toString()); assertEquals("100001m", new Quantity("100001m").toString()); assertEquals("1Mi", new Quantity("1Mi").toString()); }