### Question:
CommodityDisplayStrategy { abstract public boolean allowClick(BaseCommodityViewModel commodityViewModel);  void apply(BaseCommodityViewModel commodityViewModel, CheckBox checkboxCommoditySelected, TextView alternativeText); abstract boolean allowClick(BaseCommodityViewModel commodityViewModel); String getMessage(); boolean hideCommodities(); String getEmptyMessage(); static final CommodityDisplayStrategy DISALLOW_CLICK_WHEN_OUT_OF_STOCK; static final CommodityDisplayStrategy ALLOW_CLICK_WHEN_OUT_OF_STOCK; static final CommodityDisplayStrategy ALLOW_ONLY_LGA_COMMODITIES; }### Answer:
@Test public void shouldNotAllowClickOnNonLGAWithALLOW_ONLY_LGA_COMMODITIES() throws Exception { Commodity food = new Commodity("food"); food.setNonLGA(true); assertFalse(CommodityDisplayStrategy.ALLOW_ONLY_LGA_COMMODITIES.allowClick(new BaseCommodityViewModel(food))); }
@Test public void shouldAllowClickOnLGAWithALLOW_ONLY_LGA_COMMODITIES() throws Exception { Commodity food = new Commodity("food"); food.setNonLGA(false); assertTrue(CommodityDisplayStrategy.ALLOW_ONLY_LGA_COMMODITIES.allowClick(new BaseCommodityViewModel(food))); }
@Test public void shouldNotAllowClickForItemsWhoseStockIsFinishedForDISALLOW_CLICK_WHEN_OUT_OF_STOCK() throws Exception { Commodity food = mock(Commodity.class); when(food.isOutOfStock()).thenReturn(true); assertFalse(CommodityDisplayStrategy.DISALLOW_CLICK_WHEN_OUT_OF_STOCK.allowClick(new BaseCommodityViewModel(food))); }
@Test public void shouldAllowClickForItemsWhoseStockIsNotFinishedForDISALLOW_CLICK_WHEN_OUT_OF_STOCK() throws Exception { Commodity food = mock(Commodity.class); when(food.isOutOfStock()).thenReturn(false); assertTrue(CommodityDisplayStrategy.DISALLOW_CLICK_WHEN_OUT_OF_STOCK.allowClick(new BaseCommodityViewModel(food))); }