@Test(expected = AbstractPageController.HttpNotFoundException.class)
 public void testRenderComponentNotFound2() throws Exception {
   given(request.getAttribute(COMPONENT_UID)).willReturn(null);
   given(request.getParameter(COMPONENT_UID)).willReturn(TEST_COMPONENT_UID);
   given(cmsComponentService.getSimpleCMSComponent(TEST_COMPONENT_UID)).willReturn(null);
   productReferencesComponentController.handleGet(request, response, model);
 }
  @Test
  public void testRenderComponentUid() throws Exception {
    given(request.getAttribute(COMPONENT_UID)).willReturn(TEST_COMPONENT_UID);
    given(cmsComponentService.getAbstractCMSComponent(TEST_COMPONENT_UID))
        .willReturn(productReferencesComponentModel);
    given(productReferencesComponentModel.getMaximumNumberProducts())
        .willReturn(Integer.valueOf(1));
    given(productReferencesComponentModel.getTitle()).willReturn(TITLE_VALUE);
    given(productReferencesComponentModel.getProductReferenceTypes())
        .willReturn(Arrays.asList(ProductReferenceTypeEnum.ACCESSORIES));
    given(productReferencesComponentModel.getItemtype()).willReturn(TEST_TYPE_CODE);

    requestContextData.setProduct(new ProductModel());
    given(
            productFacade.getProductReferencesForCode(
                Mockito.anyString(),
                Mockito.anyList(),
                Mockito.any(List.class),
                Mockito.<Integer>any()))
        .willReturn(productReferenceDataList);

    final String viewName =
        productReferencesComponentController.handleGet(request, response, model);
    verify(model, Mockito.times(1)).addAttribute(COMPONENT, productReferencesComponentModel);
    verify(model, Mockito.times(1)).addAttribute(TITLE, TITLE_VALUE);
    verify(model, Mockito.times(1)).addAttribute(PRODUCT_REFERENCES, productReferenceDataList);
    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 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());
 }