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

📄 testwebstorepojo_update.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.ICategory;
import com.sush.webstore.store.domain.IItem;
import com.sush.webstore.store.domain.IProduct;
import com.sush.webstore.store.domain.IUserAccount;
import com.sush.webstore.store.domain.IWebStoreFacade;
import com.sush.webstore.store.domain.facade.WebStorePOJO;

import junit.framework.TestCase;

public class TestWebStorePOJO_Update extends TestCase {

	private IWebStoreFacade store;

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

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

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

	public final void testUpdateCatalog() {

		ICatalog ct1 = store.getCatalog(1);
		ct1.setDescription("description1...updated");
		ICatalog ct2 = store.getCatalog(2);
		ct2.setDescription("description2...updated");
		store.updateCatalog(ct1);
		store.updateCatalog(ct2);

		assertTrue(store.getCatalog(1).getDescription().equals(
				"description1...updated"));
		assertTrue(store.getCatalog(2).getDescription().equals(
				"description2...updated"));
	}

	public final void testUpdateCategory() {

		ICategory ctg1 = store.getCategory(1);
		ICategory ctg2 = store.getCategory(2);
		ICategory ctg3 = store.getCategory(3);
		ICategory ctg4 = store.getCategory(4);
		ICategory ctg5 = store.getCategory(5);
		ICategory ctg6 = store.getCategory(6);
		ICategory ctg7 = store.getCategory(7);
		ICategory ctg8 = store.getCategory(8);
		ICategory ctg9 = store.getCategory(9);
		ICategory ctg10 = store.getCategory(10);

		ctg1.setDescription("description1...updated");
		ctg2.setDescription("description2...updated");
		ctg3.setDescription("description3...updated");
		ctg4.setDescription("description4...updated");
		ctg5.setDescription("description5...updated");
		ctg6.setDescription("description6...updated");
		ctg7.setDescription("description7...updated");
		ctg8.setDescription("description8...updated");
		ctg9.setDescription("description9...updated");
		ctg10.setDescription("description10...updated");

		store.updateCategory(ctg1);
		store.updateCategory(ctg9);

		assertTrue(store.getCategory(1).getDescription().equals(
				"description1...updated"));
		assertTrue(store.getCategory(9).getDescription().equals(
				"description9...updated"));
	}

	public final void testUpdateItem() {

		IItem i1 = store.getItem(1);
		i1.setDescription("description1...updated");
		IItem i2 = store.getItem(2);
		i2.setDescription("description2...updated");

		store.updateItem(i1);
		store.updateItem(i2);

		assertTrue(store.getItem(1).getDescription().equals(
				"description1...updated"));
		assertTrue(store.getItem(2).getDescription().equals(
				"description2...updated"));
	}

	public final void testUpdateProduct() {

		IProduct i1 = store.getProduct(1);
		i1.setDescription("description1...updated");
		IProduct i2 = store.getProduct(2);
		i2.setDescription("description2...updated");

		store.updateProduct(i1);
		store.updateProduct(i2);

		assertTrue(store.getProduct(1).getDescription().equals(
				"description1...updated"));
		assertTrue(store.getProduct(2).getDescription().equals(
				"description2...updated"));
	}

	public final void testUpdateUserAccount() {

		IUserAccount i1 = store.getUserAccount(1);
		i1.setFirstName("fname1...updated");

		store.updateUserAccount(i1);

		assertTrue(store.getUserAccount(1).getFirstName().equals(
				"fname1...updated"));
	}
}

⌨️ 快捷键说明

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