@Test public void toStringWithSignAlwaysAddsASignEvenWhenPriceIsPositive() { assertThat(new Price(158636).toStringWithSign()).isEqualTo("+1.58636"); assertThat(new Price(951).toStringWithSign()).isEqualTo("+0.00951"); assertThat(new Price(95100).toStringWithSign()).isEqualTo("+0.95100"); assertThat(new Price(-10).toStringWithSign()).isEqualTo("-0.00010"); assertThat(new Price(-995183).toStringWithSign()).isEqualTo("-9.95183"); assertThat(new Price(0).toStringWithSign()).isEqualTo("+0.00000"); }
public String toStringWithSign() { final long absolute = absolute().price; return (price < 0 ? "-" : "+") + absolute / ACCURACY + "." + String.format("%05d", absolute % ACCURACY); }
Price implements Comparable<Price> { public String toStringWithSign() { final long absolute = absolute().price; return (price < 0 ? "-" : "+") + absolute / ACCURACY + "." + String.format("%05d", absolute % ACCURACY); } }
Price implements Comparable<Price> { public String toStringWithSign() { final long absolute = absolute().price; return (price < 0 ? "-" : "+") + absolute / ACCURACY + "." + String.format("%05d", absolute % ACCURACY); } Price(final double price);  Price(final long price);  Price(final long value, final PriceUnit unit); }
Price implements Comparable<Price> { public String toStringWithSign() { final long absolute = absolute().price; return (price < 0 ? "-" : "+") + absolute / ACCURACY + "." + String.format("%05d", absolute % ACCURACY); } Price(final double price);  Price(final long price);  Price(final long value, final PriceUnit unit); long asPipette(); double asDouble(); Price plus(final Price other); Price plus(final int amount, final PriceUnit unit); Price plus(final double value, final RatioUnit unit); Price plus(final Ratio ratio); Price minus(final Price other); Price minus(final int amount, final PriceUnit unit); Price minus(final double value, final RatioUnit unit); Price minus(final Ratio ratio); Price inverse(); Price absolute(); Price multiply(final Ratio ratio); Money multiply(final Volume volume, final Currency currency); Ratio divide(final Price divisor); boolean isLessThan(final Price other); boolean isGreaterThan(final Price other); boolean isStrongerThan(final Price other, final MarketDirection direction); boolean isWeakerThan(final Price other, final MarketDirection direction); boolean isBetweenInclusive(final Price a, final Price b); @Override boolean equals(final Object other); @Override int compareTo(final Price other); @Override int hashCode(); String toStringWithSign(); @Override String toString(); }
Price implements Comparable<Price> { public String toStringWithSign() { final long absolute = absolute().price; return (price < 0 ? "-" : "+") + absolute / ACCURACY + "." + String.format("%05d", absolute % ACCURACY); } Price(final double price);  Price(final long price);  Price(final long value, final PriceUnit unit); long asPipette(); double asDouble(); Price plus(final Price other); Price plus(final int amount, final PriceUnit unit); Price plus(final double value, final RatioUnit unit); Price plus(final Ratio ratio); Price minus(final Price other); Price minus(final int amount, final PriceUnit unit); Price minus(final double value, final RatioUnit unit); Price minus(final Ratio ratio); Price inverse(); Price absolute(); Price multiply(final Ratio ratio); Money multiply(final Volume volume, final Currency currency); Ratio divide(final Price divisor); boolean isLessThan(final Price other); boolean isGreaterThan(final Price other); boolean isStrongerThan(final Price other, final MarketDirection direction); boolean isWeakerThan(final Price other, final MarketDirection direction); boolean isBetweenInclusive(final Price a, final Price b); @Override boolean equals(final Object other); @Override int compareTo(final Price other); @Override int hashCode(); String toStringWithSign(); @Override String toString();  }