Measure implements Comparable<Measure<T>> { public static <U extends Enum<U> & Unit<U>> Measure<U> of(long quantity, U type) { return new Measure<>(BigInteger.valueOf(quantity), type); } protected  Measure(BigInteger quantity, T unit); static Measure<U> of(long quantity, U type); static Measure<U> of(BigInteger quantity, U type); static Measure<U> zero(Class<U> unitType); static Measure<U> parse(String quantityUnit, Class<U> unitType); static Measure<U> parse(String quantityUnit, Class<U> unitType, Collection<U> validUnits); long getQuantity(); long getQuantity(T unit); BigInteger getExactQuantity(); BigInteger getExactQuantity(T unit); Measure<T> to(T unit); T getUnit(); Measure<T> add(long quantity, T unit); Measure<T> add(BigInteger quantity, T unit); Measure<T> add(long amount); Measure<T> add(BigInteger amount); Measure<T> multiply(long factor); Measure<T> multiply(BigInteger factor); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); @Override int compareTo(Measure<T> o);  }
@Test public void test_of() { assertThat(() -> Measure.of(1, null), is(throwing(instanceOf(NullPointerException.class)))); assertThat( () -> Measure.of(-1, GB), is(throwing(instanceOf(IllegalArgumentException.class)).andMessage(containsString("cannot be negative")))); }
@Test public void test_equals() { assertThat(Measure.of(1, GB), is(equalTo(Measure.of(1, GB)))); }