源代码id3java的简单介绍( 三 )


assertEquals(exceptedcip3, LibManagerDA.getBookCip(bookid3));
}
public void testCheckReserved(){
String cip1 = "123456";
String cip2 = "234567";
int studentid1 = 1;
int studentid2 = 2;
int studentid3 = 99;
assertEquals(true, LibManagerDA.checkReserved(cip1,studentid1));
assertEquals(true, LibManagerDA.checkReserved(cip2,studentid2));
assertEquals(false, LibManagerDA.checkReserved(cip1,studentid2));
assertEquals(false,LibManagerDA.checkReserved(cip2,studentid1));
assertEquals(false,LibManagerDA.checkReserved(cip2,studentid3));
assertEquals(false,LibManagerDA.checkReserved(cip1,studentid3));
}
//public static boolean borrowOPeration(int quantity, int bookID, int borrowerID,int reservedNum, int borrowedNum,Date startDate)
public void testBorrowOPeration(){
int quantity1 = 1;
int bookID1 = 2;
int borrowerID1 = 3;
int reservedNum1 = 1;
int borrowedNum1 = 4;
int quantity2 = 1;
int bookID2 = 1;
int borrowerID2 = 3;
int reservedNum2= 0;
int borrowedNum2 = 7;
assertEquals(true,LibManagerDA.borrowOperation(quantity1, bookID1, borrowerID1, reservedNum1, borrowedNum1, new Date()));
assertEquals(false,LibManagerDA.borrowOperation(quantity2, bookID2, borrowerID2, reservedNum2, borrowedNum2, new Date()));
}
//public static boolean returnOperation (int quantity, int bookID, int borrowerID, int borrowedNum, Date startDate, int reborrowable)
public void testReturnOperation(){
int quantity1 = 1;
int bookID1 = 1;
int borrowerID1 = 1;
int borrowedNum1 = 4;
int reborrowable1 = 0;
int quantity2 = 1;
int bookID2 = 2;
int borrowerID2 = 2;
int borrowedNum2 = 7;
int reborrowable2 = 0;
assertEquals(true,LibManagerDA.returnOperation(quantity1, bookID1, borrowerID1, borrowedNum1, new Date(),reborrowable1));
assertEquals(true,LibManagerDA.returnOperation(quantity2, bookID2, borrowerID2, borrowedNum2,new Date(), reborrowable2));
}
public void testGetBookQuantity(){
String cip1 = "123456";
String cip2 = "234567";
int quantity1 = 5;
int quantity2 = 3;
assertEquals(quantity1,LibManagerDA.getBookQuantity(cip1));
assertEquals(quantity2,LibManagerDA.getBookQuantity(cip2));
}
public void testFindBill(){
String userName1 = "111111";
String userName2 = "222222";
float bill1 = 0;
float bill2 = 0;
assertEquals(bill1,LibManagerDA.findBill(userName1),0.000001);
assertEquals(bill2,LibManagerDA.findBill(userName2),0.000001);
}
public void testClearBill(){
String userName1 = "111111";
String userName2 = "222222";
assertEquals(true,LibManagerDA.clearBill(userName1));
assertEquals(true,LibManagerDA.clearBill(userName2));
}
public void testSelectAllLibManager(){
Vector allLibManager = new Vector();
allLibManager = LibManagerDA.selectAllLibManager();
for(int i = 0;i allLibManager.size();i++ ){
LibManager libManager = (LibManager)allLibManager.get(i);
System.out.println(libManager.getName());
}
}
public void testSecelctAllStudent(){
Vector allStudent = new Vector();
allStudent = LibManagerDA.secelctAllStudent();
for(int i = 0;i allStudent.size();i++ ){
Student student = (Student)allStudent.get(i);
System.out.println(student.getName());
}
}
public void testStartTimes(){
Vector times = new Vector();
times = LibManagerDA.startTimes(0);
for(int i= 0;itimes.size();i ++)
System.out.println((Date)times.get(i));
}
public void testUpdateStuBill() {
}
public static void main(String[] args) {
junit.textui.TestRunner.run(TestLibManagerDA.class);
System.out.println(new TestLibManagerDA("dd ").countTestCases());
}
}
/*

推荐阅读