@Before
  public void setUp() throws CMSItemNotFoundException {
    MockitoAnnotations.initMocks(this);
    miniCartComponentController = new MiniCartComponentController();
    miniCartComponentController.setCmsComponentService(cmsComponentService);

    miniCartComponentModel = new MiniCartComponentModel();

    final PriceData subTotal = new PriceData();
    subTotal.setValue(SUB_TOTAL_VALUE);
    final PriceData totalPrice = new PriceData();
    totalPrice.setValue(TOTAL_VALUE);
    final PriceData deliveryCost = new PriceData();
    deliveryCost.setValue(DELIVERY_VALUE);

    final CartData cartData = new CartData();
    cartData.setSubTotal(subTotal);
    cartData.setTotalPrice(totalPrice);
    cartData.setDeliveryCost(deliveryCost);
    cartData.setTotalUnitCount(TOTAL_UNIT_COUNT);

    given(cartFacade.getMiniCart()).willReturn(cartData);
    given(request.getAttribute(COMPONENT_UID)).willReturn(TEST_COMPONENT_UID);

    ReflectionTestUtils.setField(
        miniCartComponentController, "cartFacade", cartFacade, CartFacade.class);
  }
 @Test
 public void testRenderComponent() throws Exception {
   final ExtendedModelMap model = new ExtendedModelMap();
   final String viewName =
       miniCartComponentController.handleComponent(
           request, response, model, miniCartComponentModel);
   Assert.assertEquals(TEST_TYPE_VIEW, viewName);
 }
 @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());
 }