⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testwebstorepojo_select.java

📁 基于Struts的网络商店源码。使用Hibernate技术
💻 JAVA
字号:
package com.sush.sample.webstore.store.domain.test;

import com.sush.webstore.store.domain.ICatalog;
import com.sush.webstore.store.domain.IImage;
import com.sush.webstore.store.domain.IWebStoreFacade;
import com.sush.webstore.store.domain.facade.WebStorePOJO;

import junit.framework.TestCase;

public class TestWebStorePOJO_Select extends TestCase {

	private IWebStoreFacade store;

	public TestWebStorePOJO_Select(String arg0) {
		super(arg0);
	}

	protected void setUp() throws Exception {
		store = new WebStorePOJO();
	}

	protected void tearDown() throws Exception {
		super.tearDown();
	}

	public final void testGetCatalog() {

		ICatalog cat1 = store.getCatalog(1);
		assertNotNull(cat1);
		
		ICatalog cat2 = store.getCatalog(2);
		assertNotNull(cat2);
		
		IImage img1 = store.createImage();
		img1.setName("name1");
		img1.setPath("C:/work/axiom-suite/WebStoreApp/webapp/images/addToCart.gif");
		
		cat1.getIImages().addImage(img1);
		cat2.getIImages().addImage(img1);	
		
		store.updateCatalog(cat1);
		store.updateCatalog(cat2);
	}

	public final void testGetCatalogs() {

		assertNotNull(store.getCatalogs());
	}

	public final void testGetCategory() {

		assertNotNull(store.getCategory(1));
		assertNotNull(store.getCategory(2));
		assertNotNull(store.getCategory(3));
		assertNotNull(store.getCategory(4));
		assertNotNull(store.getCategory(5));
		assertNotNull(store.getCategory(6));
		assertNotNull(store.getCategory(7));
		assertNotNull(store.getCategory(8));
		assertNotNull(store.getCategory(9));
		assertNotNull(store.getCategory(10));
	}

	public final void testGetCategories() {

		assertNotNull(store.getCategories(store.getCatalog(1)));
		assertNotNull(store.getCategories(store.getCatalog(2)));
	}

	public final void testGetItem() {

		assertNotNull(store.getItem(1));
		assertNotNull(store.getItem(2));
		assertNotNull(store.getItem(3));
		assertNotNull(store.getItem(4));
		assertNotNull(store.getItem(5));
	}

	public final void testGetItems() {

		assertNotNull(store.getItems(store.getProduct(1)));
		assertNotNull(store.getItems(store.getProduct(2)));
		assertNotNull(store.getItems(store.getProduct(3)));
		assertNotNull(store.getItems(store.getProduct(4)));
		assertNotNull(store.getItems(store.getProduct(5)));
	}

	public final void testGetOrder() {

		assertNotNull(store.getOrder(1));
	}

	public final void testGetOrders() {

		assertNotNull(store.getOrders("userName1"));
	}

	public final void testGetProduct() {

		assertNotNull(store.getProduct(1));
		assertNotNull(store.getProduct(2));
		assertNotNull(store.getProduct(3));
		assertNotNull(store.getProduct(4));
		assertNotNull(store.getProduct(5));
	}

	public final void testGetProducts() {

		assertNotNull(store.getProducts(store.getCategory(6)));
		assertNotNull(store.getProducts(store.getCategory(7)));
		assertNotNull(store.getProducts(store.getCategory(8)));
		assertNotNull(store.getProducts(store.getCategory(9)));
		assertNotNull(store.getProducts(store.getCategory(10)));
	}

	public final void testGetSubCategories() {

		assertNotNull(store.getSubCategories(store.getCategory(1)));
		assertNotNull(store.getSubCategories(store.getCategory(2)));
		assertNotNull(store.getSubCategories(store.getCategory(3)));
		assertNotNull(store.getSubCategories(store.getCategory(4)));
		assertNotNull(store.getSubCategories(store.getCategory(5)));
	}

	public final void testGetUserAccounts() {

		assertNotNull(store.getUserAccount(1));
		assertNotNull(store.getUserAccount("userName1"));
		assertNotNull(store.getUserAccount("userName1", "password1"));
	}

	public final void testHasDisplayableItem() {

		assertTrue(store.hasDisplayableItem(store.getProduct(1)));
		assertTrue(store.hasDisplayableItem(store.getProduct(2)));
		assertTrue(store.hasDisplayableItem(store.getProduct(3)));
		assertTrue(store.hasDisplayableItem(store.getProduct(4)));
		assertTrue(store.hasDisplayableItem(store.getProduct(5)));
	}

	public final void testHasProducts() {

		assertFalse(store.hasProducts(store.getCategory(1)));
		assertFalse(store.hasProducts(store.getCategory(2)));
		assertFalse(store.hasProducts(store.getCategory(3)));
		assertFalse(store.hasProducts(store.getCategory(4)));
		assertFalse(store.hasProducts(store.getCategory(5)));

		assertTrue(store.hasProducts(store.getCategory(6)));
		assertTrue(store.hasProducts(store.getCategory(7)));
		assertTrue(store.hasProducts(store.getCategory(8)));
		assertTrue(store.hasProducts(store.getCategory(9)));
		assertTrue(store.hasProducts(store.getCategory(10)));
	}

	public final void testHasSubCategories() {

		assertTrue(store.hasSubCategories(store.getCategory(1)));
		assertTrue(store.hasSubCategories(store.getCategory(2)));
		assertTrue(store.hasSubCategories(store.getCategory(3)));
		assertTrue(store.hasSubCategories(store.getCategory(4)));
		assertTrue(store.hasSubCategories(store.getCategory(5)));

		assertFalse(store.hasSubCategories(store.getCategory(6)));
		assertFalse(store.hasSubCategories(store.getCategory(7)));
		assertFalse(store.hasSubCategories(store.getCategory(8)));
		assertFalse(store.hasSubCategories(store.getCategory(9)));
		assertFalse(store.hasSubCategories(store.getCategory(10)));
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -