Package org.landal.mvcsample.service.impl

Examples of org.landal.mvcsample.service.impl.SimpleProductManager


public class InventoryControllerTest extends TestCase {

  public void testHandleRequestView() throws Exception {
    InventoryController controller = new InventoryController();
    controller.setProductManager(new SimpleProductManager());
    ModelAndView modelAndView = controller.handleRequest(null, null);
    assertEquals("hello", modelAndView.getViewName());
    assertNotNull(modelAndView.getModel());
    Map modelMap = (Map) modelAndView.getModel().get("model");
    String nowValue = (String) modelMap.get("now");
View Full Code Here


  private static Double TABLE_PRICE = new Double(150.10);

  private static int POSITIVE_PRICE_INCREASE = 10;

  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);
View Full Code Here

    products.add(product);
    productManager.setProducts(products);
  }

  public void testGetProductsWithNoProducts() {
    productManager = new SimpleProductManager();
    assertNull(productManager.getProducts());
  }
View Full Code Here

    assertEquals(TABLE_PRICE, product.getPrice());
  }

  public void testIncreasePriceWithNullListOfProducts() {
    try {
      productManager = new SimpleProductManager();
      productManager.increasePrice(POSITIVE_PRICE_INCREASE);
    } catch (NullPointerException ex) {
      fail("Products list is null.");
    }
  }
View Full Code Here

    }
  }

  public void testIncreasePriceWithEmptyListOfProducts() {
    try {
      productManager = new SimpleProductManager();
      productManager.setProducts(new ArrayList<Product>());
      productManager.increasePrice(POSITIVE_PRICE_INCREASE);
    } catch (Exception ex) {
      fail("Products list is empty.");
    }
View Full Code Here

TOP

Related Classes of org.landal.mvcsample.service.impl.SimpleProductManager

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.