/** * Ensure correct query function implementations, providing also * the some test implementations with the TCK. */ @Test(description = "4.2.7 Ensure correct query function, Monetary.getAmountFactories should return factory" + "for explicit acquired amount types.") @SpecAssertion(section = "4.2.7", id = "427-B4") public void testAmountQueryType() { MonetaryAmountFactoryQuery ctx = MonetaryAmountFactoryQueryBuilder.of().setTargetType(TestAmount.class).build(); Collection<MonetaryAmountFactory<?>> factories = Monetary.getAmountFactories(ctx); AssertJUnit.assertNotNull("Section 4.2.7: Amount factory query should return explicitly queried factories", factories); boolean found = false; for (MonetaryAmountFactory<?> f : factories) { if (f.getAmountType().equals(TestAmount.class)) { found = true; break; } } AssertJUnit.assertTrue("Section 4.2.7: Amount type query should return same explicitly queried factory", found); ctx = MonetaryAmountFactoryQueryBuilder.of().build(); MonetaryAmountFactory<?> factory = Monetary.getAmountFactory(ctx); AssertJUnit.assertNotNull("Section 4.2.7: Amount type must be provided", factory); }