### Question:
Money implements MonetaryAmount, Comparable<MonetaryAmount>, Serializable { @Override public <R> R query(MonetaryQuery<R> query) { Objects.requireNonNull(query); try { return query.queryFrom(this); } catch (MonetaryException e) { throw e; } catch (Exception e) { throw new MonetaryException("Query failed: " + query, e); } } private  Money(BigDecimal number, CurrencyUnit currency); private  Money(BigDecimal number, CurrencyUnit currency, MonetaryContext monetaryContext); @Override CurrencyUnit getCurrency(); @Override MonetaryContext getContext(); @Override NumberValue getNumber(); BigDecimal getNumberStripped(); @Override int compareTo(MonetaryAmount o); @Override Money abs(); @Override Money divide(long divisor); @Override Money divide(double divisor); @Override Money[] divideAndRemainder(long divisor); @Override Money[] divideAndRemainder(double divisor); @Override Money multiply(long multiplicand); @Override Money multiply(double multiplicand); @Override Money remainder(long divisor); @Override Money remainder(double divisor); @Override boolean isZero(); @Override boolean isPositive(); @Override boolean isPositiveOrZero(); @Override boolean isNegative(); @Override boolean isNegativeOrZero(); @Override R query(MonetaryQuery<R> query); @Override Money with(MonetaryOperator operator); @Override Money add(MonetaryAmount amount); @Override Money divide(Number divisor); @Override Money[] divideAndRemainder(Number divisor); @Override Money divideToIntegralValue(long divisor); @Override Money divideToIntegralValue(double divisor); @Override Money divideToIntegralValue(Number divisor); @Override Money multiply(Number multiplicand); @Override Money negate(); @Override Money plus(); @Override Money subtract(MonetaryAmount subtrahend); @Override Money stripTrailingZeros(); @Override Money remainder(Number divisor); @Override Money scaleByPowerOfTen(int power); @Override int signum(); @Override boolean isLessThan(MonetaryAmount amount); @Override boolean isLessThanOrEqualTo(MonetaryAmount amount); @Override boolean isGreaterThan(MonetaryAmount amount); @Override boolean isGreaterThanOrEqualTo(MonetaryAmount amount); @Override boolean isEqualTo(MonetaryAmount amount); @Override MonetaryAmountFactory<Money> getFactory(); @Override boolean equals(Object obj); @Override String toString(); @Override int hashCode(); static Money of(BigDecimal number, CurrencyUnit currency); static Money of(BigDecimal number, CurrencyUnit currency, MonetaryContext monetaryContext); static Money of(Number number, CurrencyUnit currency); static Money of(Number number, CurrencyUnit currency, MonetaryContext monetaryContext); static Money of(Number number, String currencyCode); static Money of(BigDecimal number, String currencyCode); static Money of(Number number, String currencyCode, MonetaryContext monetaryContext); static Money of(BigDecimal number, String currencyCode, MonetaryContext monetaryContext); static Money zero(CurrencyUnit currency); static Money ofMinor(CurrencyUnit currency, long amountMinor); static Money ofMinor(CurrencyUnit currency, long amountMinor, int fractionDigits); static Money from(MonetaryAmount amt); static Money parse(CharSequence text); static Money parse(CharSequence text, MonetaryAmountFormat formatter); @Deprecated static boolean isInfinityAndNotNaN(Number number); @Deprecated static void checkNoInfinityOrNaN(Number number); static final MonetaryContext DEFAULT_MONETARY_CONTEXT; }### Answer:
@Test public void testQuery() { MonetaryQuery<Integer> q = amount -> Money.from(amount).getNumber().getPrecision(); Money[] moneys = new Money[]{Money.of(100, "CHF"), Money.of(34242344, "USD"), Money.of(23123213.435, "EUR"), Money.of(-23123213.435, "USS"), Money.of(-23123213, "USN"), Money.of(0, "GBP")}; for (Money money : moneys) { assertEquals(money.query(q), Integer.valueOf(money.getNumber().getPrecision())); } }