Package springapp.domain

Examples of springapp.domain.Product


  }

  private static class ProductMapper implements
      ParameterizedRowMapper<Product> {
    public Product mapRow(ResultSet rs, int rowNum) throws SQLException {
      Product prod = new Product();
      prod.setId(rs.getInt("id"));
      prod.setDescription(rs.getString("description"));
      prod.setPrice(new Double(rs.getDouble("price")));
      return prod;
    }
View Full Code Here


   
    sb.append(",'products':[");
   
    List<Product> prods = spm.getProducts();
    int cnt = prods.size();
    Product prod = null;
    for(int i=0;i<cnt;i++)
    {
      prod = prods.get(i);
      sb.append("['");
      sb.append(prod.getDescription());
      sb.append("',");
      sb.append(prod.getPrice());
      sb.append("]");
      if(i<cnt-1)
        sb.append(",");
    }
    sb.append("]}");
View Full Code Here

  protected void setUp() throws Exception {
    productManager = new SimpleProductManager();
    products = new ArrayList<Product>();
    // stub up a list of products
    Product product = new Product();
    product.setDescription("Chair");
    product.setPrice(CHAIR_PRICE);
    products.add(product);
    product = new Product();
    product.setDescription("Table");
    product.setPrice(TABLE_PRICE);
    products.add(product);

    ProductDao productDao = new InMemoryProductDao(products);
    productManager.setProductDao(productDao);
    // productManager.setProducts(products);
View Full Code Here

  public void testGetProducts() {
    List<Product> products = productManager.getProducts();
    assertNotNull(products);
    assertEquals(PRODUCT_COUNT, productManager.getProducts().size());
    Product product = products.get(0);
    assertEquals(CHAIR_DESCRIPTION, product.getDescription());
    assertEquals(CHAIR_PRICE, product.getPrice());
    product = products.get(1);
    assertEquals(TABLE_DESCRIPTION, product.getDescription());
    assertEquals(TABLE_PRICE, product.getPrice());
  }
View Full Code Here

  public void testIncreasePriceWithPositivePercentage() {
    productManager.increasePrice(POSITIVE_PRICE_INCREASE);
    double expectedChairPriceWithIncrease = 22.55;
    double expectedTablePriceWithIncrease = 165.11;
    List<Product> products = productManager.getProducts();
    Product product = products.get(0);
    assertEquals(expectedChairPriceWithIncrease, product.getPrice());
    product = products.get(1);
    assertEquals(expectedTablePriceWithIncrease, product.getPrice());
  }
View Full Code Here

TOP

Related Classes of springapp.domain.Product

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.