@Test public void testTotal() throws Exception { final ExtendedModelMap model = new ExtendedModelMap(); miniCartComponentModel.setTotalDisplay(CartTotalDisplayType.TOTAL); given(cmsComponentService.getAbstractCMSComponent(TEST_COMPONENT_UID)) .willReturn(miniCartComponentModel); miniCartComponentController.handleGet(request, response, model); final PriceData priceData = (PriceData) model.get(MiniCartComponentController.TOTAL_PRICE); Assert.assertEquals(TOTAL_VALUE, priceData.getValue()); }
@Test public void testRenderComponent() throws Exception { final ExtendedModelMap model = new ExtendedModelMap(); final String viewName = miniCartComponentController.handleComponent( request, response, model, miniCartComponentModel); Assert.assertEquals( ControllerConstants.Views.Cms.ComponentPrefix + StringUtils.lowerCase(miniCartComponentModel.getItemtype()), viewName); }
@Test public void testTotalWithoutDelivery() throws Exception { final ExtendedModelMap model = new ExtendedModelMap(); miniCartComponentModel.setTotalDisplay(CartTotalDisplayType.TOTAL_WITHOUT_DELIVERY); given(cmsComponentService.getSimpleCMSComponent(TEST_COMPONENT_UID)) .willReturn(miniCartComponentModel); miniCartComponentController.handleGet(request, response, model); final PriceData priceData = (PriceData) model.get(MiniCartComponentController.TOTAL_NO_DELIVERY); Assert.assertEquals(TOTAL_VALUE.subtract(DELIVERY_VALUE), priceData.getValue()); }