?? teststockmanagementdata.java
字號:
result = stockManagementData.createSupplier(supplier);
this.assertEquals("", 1, result);
}
//測試供應商更新方法
public void testSupplierUpdate() throws Exception{
String[] supplier = new String[]{"測試供應商1", "北部", "拼音碼1", "簡稱1", "021-556892",
"張凡", "1350058956", "021-896523", "021-963258", "地址1", "511896",
"中行", "銀行帳號", "jack@hotmail.com", "www.jack.com", "備注1"};
//更新供應商的值
int result = stockManagementData.updateSupplier(supplier);
this.assertEquals("", 1, result);
}
//測試根據供應商名字取得記錄的方法
public void testFindBySupplierName() throws Exception {
String[][] detail = stockManagementData.getSuppliersBySupplierName("%供應商%");
this.assertEquals("", 3, detail.length);
}
//測試根據地區取得記錄的方法
public void testFindBySupplierZone() throws Exception {
String[][] detail = stockManagementData.getSuppliersBySupplierZone("%北部%");
this.assertEquals("", 2, detail.length);
}
//測試供應商刪除方法
public void testSupplierDelete() throws Exception{
String[] suppliers = new String[]{"測試供應商1", "測試供應商2", "測試供應商3"};
//刪除供應商
int result = stockManagementData.deleteSupplier(suppliers[0]);
this.assertEquals("", 1, result);
//刪除供應商
result = stockManagementData.deleteSupplier(suppliers[1]);
this.assertEquals("", 1, result);
//刪除供應商
result = stockManagementData.deleteSupplier(suppliers[2]);
this.assertEquals("", 1, result);
}
//測試客戶創建方法
public void testCustomerCreate() throws Exception {
//創建客戶數組
String[] customer = new String[] {
"測試客戶1", "南部", "拼音碼1", "簡稱1", "021-556892",
"張凡", "1350058956", "021-896523", "021-963258", "地址1", "511896",
"中行", "銀行帳號", "jack@hotmail.com", "www.jack.com", "10000", "備注1"};
//創建客戶
int result = stockManagementData.createCustomer(customer);
this.assertEquals("", 1, result);
customer = new String[] {
"測試客戶2", "北部", "拼音碼2", "簡稱2", "021-556892",
"張凡", "1350058956", "021-896523", "021-963258", "地址2", "511896",
"中行", "銀行帳號", "jack@hotmail.com", "www.jack.com", "10000", "備注2"};
//創建客戶
result = stockManagementData.createCustomer(customer);
this.assertEquals("", 1, result);
customer = new String[] {
"測試客戶3", "南部", "拼音碼3", "簡稱3", "021-556892",
"張凡", "1350058956", "021-896523", "021-963258", "地址3", "511896",
"中行", "銀行帳號", "jack@hotmail.com", "www.jack.com", "10000", "備注3"};
//創建客戶
result = stockManagementData.createCustomer(customer);
this.assertEquals("", 1, result);
}
//測試客戶更新方法
public void testCustomerUpdate() throws Exception {
String[] customer = new String[] {
"測試客戶1", "北部", "拼音碼1", "簡稱1", "021-556892",
"張凡", "1350058956", "021-896523", "021-963258", "地址1", "511896",
"中行", "銀行帳號", "jack@hotmail.com", "www.jack.com", "10000", "備注1"};
//更新客戶的值
int result = stockManagementData.updateCustomer(customer);
this.assertEquals("", 1, result);
}
//測試根據客戶名字取得記錄的方法
public void testFindByCustomerName() throws Exception {
String[][] detail = stockManagementData.getCustomersByCustomerName("%客戶%");
this.assertEquals("", 6, detail.length);
}
//測試根據地區取得記錄的方法
public void testFindByCustomerZone() throws Exception {
String[][] detail = stockManagementData.getCustomersByCustomerZone("%北部%");
this.assertEquals("", 4, detail.length);
}
//測試設置客戶信用的方法
public void testSetCustomerCreditLimit() throws Exception{
String customerName = "測試客戶1";
double creditlimit = 0;
int result = stockManagementData.setCreditCustomer(customerName, creditlimit);
this.assertEquals("", 1, result);
}
//測試取得信用客戶記錄的方法
public void testFindCreditCustomer() throws Exception {
String[][] detail = stockManagementData.getCreditCustomer();
this.assertEquals("", 5, detail.length);
}
//測試客戶刪除方法
public void testCustomerDelete() throws Exception {
String[] customers = new String[] {
"測試客戶1", "測試客戶2", "測試客戶3"};
//刪除客戶
int result = stockManagementData.deleteCustomer(customers[0]);
this.assertEquals("", 1, result);
//刪除客戶
result = stockManagementData.deleteCustomer(customers[1]);
this.assertEquals("", 1, result);
//刪除客戶
result = stockManagementData.deleteCustomer(customers[2]);
this.assertEquals("", 1, result);
}
//測試創建倉庫的方法
public void testWarehouseCreate() throws Exception{
String[] warehouse = new String[]{"測試倉庫1", "拼單碼1", "第1廠區", "描述1"};
//創建測試倉庫
int result = stockManagementData.createWarehouse(warehouse);
this.assertEquals("", 1, result);
warehouse = new String[]{"測試倉庫2", "拼單碼2", "第2廠區", "描述2"};
//創建測試倉庫
result = stockManagementData.createWarehouse(warehouse);
this.assertEquals("", 1, result);
warehouse = new String[]{"測試倉庫3", "拼單碼3", "第3廠區", "描述3"};
//創建測試倉庫
result = stockManagementData.createWarehouse(warehouse);
this.assertEquals("", 1, result);
}
//測試修改倉庫的方法
public void testWarehouseUpdate() throws Exception{
String[] warehouseArray = new String[]{"測試倉庫1", "拼單碼1(u)", "第1廠區(u)", "描述1(u)"};
//創建更新倉庫
int result = stockManagementData.updateWarehouse(warehouseArray);
this.assertEquals("", 1, result);
}
//測試取得全部記錄的方法
public void testWarehouseFindAll() throws Exception {
String[][] returnValue = stockManagementData.getAllWarehouse();
this.assertEquals("", 3, returnValue.length);
}
//測試刪除倉庫的方法
public void testWarehouseDelete() throws Exception{
String[] warehouseArray = new String[]{"測試倉庫1", "測試倉庫2", "測試倉庫3"};
//創建測試倉庫
int result = stockManagementData.deleteWarehouse(warehouseArray[0]);
this.assertEquals("", 1, result);
//刪除測試倉庫
result = stockManagementData.deleteWarehouse(warehouseArray[1]);
this.assertEquals("", 1, result);
//刪除測試倉庫
result = stockManagementData.deleteWarehouse(warehouseArray[2]);
this.assertEquals("", 1, result);
}
//測試創建會計科目的方法
/*public void testAccountNameCreate() throws Exception{
//創建會計科目
int result = stockManagementData.createAccountName(0, "流動資產");
this.assertEquals("", 1, result);
//創建會計科目
result = stockManagementData.createAccountName(0, "固定資產");
this.assertEquals("", 1, result);
//創建會計科目
result = stockManagementData.createAccountName(1, "現金");
this.assertEquals("", 1, result);
//創建會計科目
result = stockManagementData.createAccountName(1, "銀行存款");
this.assertEquals("", 1, result);
}
//測試修改會計科目的方法
public void testAccountNameUpdate() throws Exception{
int result = stockManagementData.updateAccountName(1, 0, "流動資產(更新)");
this.assertEquals("", 1, result);
}
//測試取得全部記錄的方法
public void testAccountNameFindAll() throws Exception {
String[][] returnValue = stockManagementData.getAllAccountName();
this.assertEquals("", 4, returnValue.length);
}
//測試根據父標識取得記錄的方法
public void testAccountNameFindByParentId() throws Exception {
String[][] returnValue = stockManagementData.getAccountNameByParentid(1);
this.assertEquals("", 2, returnValue.length);
}
//測試刪除會計科目的方法
public void testAccountNameDelete() throws Exception{
int result = stockManagementData.deleteAccountName(1);
//由于流動資產科目有子科目,所以不能進行刪除操作
this.assertEquals("", 0, result);
//刪除會計科目
result = stockManagementData.deleteAccountName(2);
this.assertEquals("", 1, result);
result = stockManagementData.deleteAccountName(3);
this.assertEquals("", 1, result);
result = stockManagementData.deleteAccountName(4);
this.assertEquals("", 1, result);
result = stockManagementData.deleteAccountName(1);
this.assertEquals("", 1, result);
}*/
//測試取得科目余額的方法
public void testGetAccountBalance() throws Exception {
String ledgerDate = "200404";
int onProcess = 0;
String[][] returnValue = stockManagementData.getAccountBalance(ledgerDate, onProcess);
this.assertEquals("", 2, returnValue.length);
}
//測試根據操作程序名字取得日志記錄的方法
public void testUserLogFindByProgramName() throws Exception{
String[][] detail = stockManagementData.getUserLogByProgramName("%登陸窗口%");
this.assertEquals("", 105, detail.length);
}
//測試根據操作內容取得日志記錄的方法
public void testUserLogFindByOperationContent() throws Exception{
String[][] detail = stockManagementData.getUserLogByOperationContent("%刪除%");
this.assertEquals("", 2, detail.length);
}
//測試根據用戶名取得日志記錄的方法
public void testUserLogFindByUserName() throws Exception{
String[][] detail = stockManagementData.getUserLogByUserName("%ame%");
this.assertEquals("", 23, detail.length);
}
//測試根據日期范圍取得日志記錄的方法
public void testUserLogFindByOperationDate() throws Exception{
//創建日期類
java.util.Calendar date = java.util.Calendar.getInstance();
date.set(2004, 4, 4, 0, 0, 0);
java.sql.Timestamp startDate = new java.sql.Timestamp(date.getTime().getTime());
date.set(2004, 4, 8, 23, 59, 59);
java.sql.Timestamp endDate = new java.sql.Timestamp(date.getTime().getTime());
String[][] detail = stockManagementData.getUserLogByOperationDate(startDate, endDate);
this.assertEquals("", 69, detail.length);
}
//測試根據單據編號或者請購員名字或者倉庫名字取得庫存賬套數據表記錄的方法
public void testGetStockLedgerByStringField() throws Exception{
//根據單據編號取得記錄
String[][] detail = stockManagementData.getStockLedgerByStringField(
"200404", "orderId", "1", 0);
this.assertEquals("", 1, detail.length);
//根據請購員名字取得記錄
detail = stockManagementData.getStockLedgerByStringField("200404",
"submitUser", "請", 0);
this.assertEquals("", 5, detail.length);
//根據倉庫名字取得記錄
detail = stockManagementData.getStockLedgerByStringField("200404", "warehouse", "倉", 0);
this.assertEquals("", 3, detail.length);
}
//測試根據訂單日期取得庫存賬套數據表記錄的方法
public void testGetStockLedgerByOrderDate() throws Exception{
//創建日期類
java.util.Calendar date = java.util.Calendar.getInstance();
date.set(2004, 3, 1, 0, 0, 0);
date.set(java.util.Calendar.MILLISECOND, 0);
java.sql.Timestamp startDate = new java.sql.Timestamp(date.getTime().getTime());
date.set(2004, 3, 20, 23, 59, 59);
date.set(java.util.Calendar.MILLISECOND, 998);
java.sql.Timestamp endDate = new java.sql.Timestamp(date.getTime().getTime());
String[][] detail = stockManagementData.getStockLedgerByOrderDate("200404", startDate, endDate, 0);
this.assertEquals("", 5, detail.length);
}
//測試根據單據編號取得庫存賬套明細數據表的記錄
public void testGetStockSubLedgerByOrderId() throws Exception{
//根據單據編號取得記錄
String[][] detail = stockManagementData.getStockSubLedgerByOrderId(
"200404", "20040400001");
this.assertEquals("", 2, detail.length);
}
//測試創建庫存賬套數據表和庫存賬套明細數據表記錄的方法
public void testCreateStockLedgerAndSub() throws Exception{
/*String ledgerDate = "200405";
String[] stockLedger = {
"", "0", "供應商1", "jack", "", "", "", "", "倉庫1", "2004-5-5", "2004-5-15",
"0", ""};
String[][] stockSubLedger = {{"", "", "10000001", "10", "50", "2004-12-5"},
{"", "", "10000002", "17", "20", "2004-11-3"}};
int result = stockManagementData.createStockLedgerAndSub(ledgerDate, stockLedger, stockSubLedger);
this.assertEquals("", 1, result);*/
}
//測試更新庫存賬套數據表和庫存賬套明細數據表記錄的方法
public void testUpdateStockLedgerAndSub() throws Exception{
/*String ledgerDate = "200405";
String[] stockLedger = {
"20040500002", "0", "供應商1(u)", "jack(u)", "", "(u)", "(u)", "(u)",
"倉庫1(u)", "2004-5-6", "2004-5-16", "0", "(u)"};
String[][] stockSubLedger = {{"21", "20040500002", "10000001", "8.6", "30", "2004-12-8"},
{"22", "20040500002", "10000002", "16.5", "12", "2004-12-9"}};
int result = stockManagementData.updateStockLedgerAndSub(ledgerDate, stockLedger, stockSubLedger);
this.assertEquals("", 1, result);*/
}
//測試撤消庫存賬套數據表記錄的方法
public void testCancelStockLedgerAndSub() throws Exception{
String ledgerDate = "200405";
String orderId = "20040500002";
String remark = "倉庫1不需要該存貨.";
int result = stockManagementData.cancelStockLedgerAndSub(ledgerDate, orderId, remark);
this.assertEquals("", 1, result);
}
//測試檢查供應商的方法
public void testCheckSupplier() throws Exception{
String supplier = "供應商";
int result = stockManagementData.checkSupplier(supplier);
this.assertEquals("", 0, result);
result = stockManagementData.checkSupplier("供應商1");
this.assertEquals("", 1, result);
}
//測試檢查倉庫的方法
public void testCheckWarehouse() throws Exception{
String warehouse = "倉庫";
int result = stockManagementData.checkWarehouse(warehouse);
this.assertEquals("", 0, result);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -