@Test
  public void testPopulate() {
    // create search result values
    final SearchResultValueData searchResultValueData = new SearchResultValueData();
    final Map<String, Object> searchValueMap = new HashMap<String, Object>();
    searchValueMap.put(BillingPlanModel.BILLINGFREQUENCY, "monthly");
    searchValueMap.put(ProductModel.SOLDINDIVIDUALLY, Boolean.TRUE);
    searchValueMap.put(SubscriptionTermModel.TERMOFSERVICERENEWAL, "yearly");
    searchValueMap.put("termLimit", "18 months");
    searchValueMap.put("lowestBundlePriceValue", Double.valueOf(1.99));
    searchResultValueData.setValues(searchValueMap);

    final CurrencyModel currency = new CurrencyModel();
    currency.setIsocode("USD");
    final PriceData priceData = new PriceData();
    priceData.setValue(BigDecimal.valueOf(1.99));
    priceData.setCurrencyIso(currency.getIsocode());
    given(commonI18NService.getCurrentCurrency()).willReturn(currency);
    given(
            priceDataFactory.create(
                PriceDataType.BUY, BigDecimal.valueOf(1.99), currency.getIsocode()))
        .willReturn(priceData);

    final ProductData productData = new ProductData();
    searchProductTelcoPopulator.populate(searchResultValueData, productData);

    assertNotNull("", productData.getSubscriptionTerm());
    assertNotNull("", productData.getSubscriptionTerm().getBillingPlan());
    assertNotNull("", productData.getSubscriptionTerm().getBillingPlan().getBillingTime());
    assertEquals(
        "",
        searchProductTelcoPopulator.getValue(searchResultValueData, "billingTime"),
        productData.getSubscriptionTerm().getBillingPlan().getBillingTime().getName());
    assertEquals(
        "",
        searchProductTelcoPopulator.getValue(searchResultValueData, ProductModel.SOLDINDIVIDUALLY),
        Boolean.valueOf(productData.isSoldIndividually()));
    assertNotNull("", productData.getSubscriptionTerm().getTermOfServiceFrequency());
    assertEquals(
        "",
        searchProductTelcoPopulator.getValue(searchResultValueData, "termLimit"),
        productData.getSubscriptionTerm().getTermOfServiceFrequency().getName());
    assertNotNull("", productData.getLowestBundlePrice());
    assertEquals(
        "",
        BigDecimal.valueOf(
            ((Double)
                    searchProductTelcoPopulator.getValue(
                        searchResultValueData, "lowestBundlePriceValue"))
                .doubleValue()),
        productData.getLowestBundlePrice().getValue());
  }
  @Override
  public PriceData create(
      final PriceDataType priceType, final BigDecimal value, final CurrencyModel currency) {
    Assert.notNull(priceType, "Parameter priceType cannot be null.");
    Assert.notNull(value, "Parameter value cannot be null.");
    Assert.notNull(currency, "Parameter currency cannot be null.");

    final PriceData priceData = createPriceData();

    priceData.setPriceType(priceType);
    priceData.setValue(value);
    priceData.setCurrencyIso(currency.getIsocode());
    priceData.setFormattedValue(formatPrice(value, currency));

    return priceData;
  }