@Override
  public Product getProductById(String productId) {
    Product productById = null;

    for (Product product : listOfProducts) {
      if (productId != null
          && product.getProductId() != null
          && product.getProductId().equals(productId)) {
        productById = product;
        break;
      }
    }
    if (productById == null) {
      throw new IllegalArgumentException("No product found with the product id : " + productId);
    }
    return productById;
  }
  public InMemoryProductRepository() {
    Product iphone = new Product("P1234", "iPhone 5s", new BigDecimal(500));
    iphone.setDescription(
        "Apple iPhone 5s smartphone with 4.00-inch 640x1136 display and 8-megapixel rear camera");
    iphone.setCategory("Smart Phone");
    iphone.setManufacturer("Apple");
    iphone.setUnitsInStock(1000);

    Product laptop_dell = new Product("P1235", "Dell Inspiron", new BigDecimal(700));
    laptop_dell.setDescription(
        "Dell Inspiron 14-inch Laptop (Black) with 3rd Generation Intel Core processors");
    laptop_dell.setCategory("Laptop");
    laptop_dell.setManufacturer("Dell");
    laptop_dell.setUnitsInStock(1000);

    Product tablet_Nexus = new Product("P1236", "Nexus 7", new BigDecimal(300));
    tablet_Nexus.setDescription(
        "Google Nexus 7 is the lightest 7 inch tablet With a quad-core Qualcomm Snapdragon S4 Pro processor");
    tablet_Nexus.setCategory("Tablet");
    tablet_Nexus.setManufacturer("Google");
    tablet_Nexus.setUnitsInStock(1000);

    listOfProducts.add(iphone);
    listOfProducts.add(laptop_dell);
    listOfProducts.add(tablet_Nexus);
  }