MoneySource implements Permission { public String value() { if (!wallet && !card) { throw new IllegalArgumentException("money-source expected"); } String params; if (wallet && card) params = WALLET + "\",\"" + CARD; else { params = card ? CARD : WALLET; } return "money-source(\"" + params + "\")"; } MoneySource(boolean wallet, boolean card); String value();  }
@Test public void testWallet() throws Exception { MoneySource moneySource = new MoneySource(true, false); assertEquals("money-source(\"wallet\")", moneySource.value()); }
@Test public void testWalletAndCard() throws Exception { MoneySource moneySource = new MoneySource(true, true); assertEquals("money-source(\"wallet\",\"card\")", moneySource.value()); }