📄 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 + -