📄 teststockmanagementdatacactus1.java
字号:
String[][] detail = stockManagementData.getGoodsByGoodsCategory(goodsCategory);
this.assertEquals("", 2, detail.length);
}
//测试根据条形码取得商品的方法
public void testFindByGoodsBarCode() throws Exception {
String goodsBarCode = "1";
String[][] detail = stockManagementData.getGoodsByGoodsBarCode(goodsBarCode);
this.assertEquals("", 2, detail.length);
}
//测试根据商品名字取得商品的方法
public void testFindByGoodsName() throws Exception {
String goodsName = "商品";
String[][] detail = stockManagementData.getGoodsByGoodsName(goodsName);
this.assertEquals("", 2, detail.length);
}
//测试根据生产厂商取得商品的方法
public void testFindByProducer() throws Exception {
String goodsName = "生产厂商";
String[][] detail = stockManagementData.getGoodsByProducer(goodsName);
this.assertEquals("", 2, detail.length);
}
//测试设置商品折扣的方法
public void testSetGoodsDiscount() throws Exception {
String goodsBarCode = "10000001";
double discount = 0.85;
int result = stockManagementData.setGoodsDiscount(goodsBarCode, discount);
this.assertEquals("return value", 1, result);
}
//测试取得折扣商品的方法
public void testFindDiscountGoods() throws Exception {
String[][] detail = stockManagementData.getDiscountGoods();
this.assertEquals("", 2, detail.length);
}
//测试商品删除方法
public void testGoodsDelete() throws Exception {
/*String goodsBarCode = "10000001";
int result = stockManagementData.deleteGoods(goodsBarCode);
this.assertEquals("return value", 1, result);
goodsBarCode = "10000002";
result = stockManagementData.deleteGoods(goodsBarCode);
this.assertEquals("return value", 1, result);*/
}
//测试供应商创建方法
public void testSupplierCreate() 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.createSupplier(supplier);
this.assertEquals("", 1, result);
supplier = new String[]{"测试供应商2", "北部", "拼音码2", "简称2", "021-556892",
"张凡", "1350058956", "021-896523", "021-963258", "地址2", "511896",
"中行", "银行帐号", "jack@hotmail.com", "www.jack.com", "备注2"};
//创建供应商
result = stockManagementData.createSupplier(supplier);
this.assertEquals("", 1, result);
supplier = new String[]{"测试供应商3", "南部", "拼音码3", "简称3", "021-556892",
"张凡", "1350058956", "021-896523", "021-963258", "地址3", "511896",
"中行", "银行帐号", "jack@hotmail.com", "www.jack.com", "备注3"};
//创建供应商
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);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -