@Test public void testAvailability() { int id = 10; Purchasable purchasable = mock(Purchasable.class); when(purchasable.getPrice()).thenReturn(100L); when(purchasable.getId()).thenReturn(id); BalanceKitPermissions kitPermissions = new BalanceKitPermissions( purchasable ); KitChallenger kitChallenger = mock(KitChallenger.class); when(kitChallenger.hasPurchase(eq(id))).thenReturn(true); kitPermissions.isAvailableTo(kitChallenger); }
@Override public boolean isAvailableTo(KitChallenger kitChallenger) { return kitChallenger.hasPurchase(purchasableId); }
BalanceKitPermissions extends KitPermissions { @Override public boolean isAvailableTo(KitChallenger kitChallenger) { return kitChallenger.hasPurchase(purchasableId); } }
BalanceKitPermissions extends KitPermissions { @Override public boolean isAvailableTo(KitChallenger kitChallenger) { return kitChallenger.hasPurchase(purchasableId); } BalanceKitPermissions(Purchasable purchasable); }
BalanceKitPermissions extends KitPermissions { @Override public boolean isAvailableTo(KitChallenger kitChallenger) { return kitChallenger.hasPurchase(purchasableId); } BalanceKitPermissions(Purchasable purchasable); @Override boolean isAvailableTo(KitChallenger kitChallenger); @Override Message unavailabilityMessage(KitChallenger kitChallenger); }
BalanceKitPermissions extends KitPermissions { @Override public boolean isAvailableTo(KitChallenger kitChallenger) { return kitChallenger.hasPurchase(purchasableId); } BalanceKitPermissions(Purchasable purchasable); @Override boolean isAvailableTo(KitChallenger kitChallenger); @Override Message unavailabilityMessage(KitChallenger kitChallenger);  }