### Question:
ExtractorMinorPartQuery implements MonetaryQuery<Long> { @Override public Long queryFrom(MonetaryAmount amount) { Objects.requireNonNull(amount, "Amount required."); int fractionDigits = amount.getCurrency().getDefaultFractionDigits(); BigDecimal number = amount.getNumber().numberValue(BigDecimal.class); return number.setScale(fractionDigits, RoundingMode.DOWN) .remainder(BigDecimal.ONE) .movePointRight(fractionDigits).longValue(); } ExtractorMinorPartQuery(); @Override Long queryFrom(MonetaryAmount amount);  }### Answer:
@Test(expectedExceptions = NullPointerException.class) public void shouldReturnNPEWhenTheMonetaryAmountIsNull() { query.queryFrom(null); fail(); }
@Test public void shouldReturnMajorPartPositive() { MonetaryAmount monetaryAmount = Money.parse("EUR 2.35"); Long result = query.queryFrom(monetaryAmount); Long expected = 35L; assertEquals(result, expected); }
@Test public void shouldReturnMajorPartNegative() { MonetaryAmount monetaryAmount = Money.parse("BHD -1.345"); Long result = query.queryFrom(monetaryAmount); Long expected = -345L; assertEquals(result, expected); }