accounttest.java

来自「酒店网上预订系统 (网上预订酒店)」· Java 代码 · 共 84 行

JAVA
84
字号
package tarena.netctoss.test;import java.util.Collection;import org.springframework.context.ApplicationContext;import org.springframework.context.support.ClassPathXmlApplicationContext;import tarena.netctoss.biz.IAccountMgmtBIZ;import tarena.netctoss.model.Account;import tarena.netctoss.model.AccountDetail;public class AccountTest {	private IAccountMgmtBIZ accountMgmtBIZ;	public IAccountMgmtBIZ getAccountMgmtBIZ() {		return accountMgmtBIZ;	}	public void setAccountMgmtBIZ(IAccountMgmtBIZ accountMgmtBIZ) {		this.accountMgmtBIZ = accountMgmtBIZ;	}	public void testFindAllAccounts(){		System.out.println("start testFindAllAccounts");		Collection<Account> c = null;		int year = 2008;		int month = 8;		c = accountMgmtBIZ.findAllAccounts(year, month);		System.out.println(c.size());		for(Account a : c){			System.out.println(a.toString());		}		System.out.println("end testFindAllAccounts");	}		public void testFindAllAccountsByYear(){		System.out.println("start testFindAllAccountsByYear");		Collection<Account> c = null;		int year = 2008;		c = accountMgmtBIZ.findAllAccounts(year);		for(Account a : c){			System.out.println(a.toString());		}		System.out.println("end testFindAllAccountsByYear");	}	public void testFindAccountDetails(){		System.out.println("start testFindAccountDetails");		Collection<Account> c = null;		String labIp = "192.168.1.23";		int year = 2008;		c = accountMgmtBIZ.findAccountDetails(labIp, year);		int i = 1;		for(Account a : c){			System.out.println(i + "月份 | 总计" + a.getTimeDuration());			i++;		}		System.out.println("end testFindAccountDetails");	}		public void testFindAccountDetailsByMonth(){		System.out.println("start testFindAccountDetailsByMonth");		Collection<AccountDetail> c = null;		String labIp = "192.168.1.23";		int year = 2008;		int month = 8;		c = accountMgmtBIZ.findAccountDetails(labIp, year, month);		int i = 1;		for(AccountDetail a : c){			System.out.println("第" + i + ":" + a.getNum() + "天 | 总计" + a.getTimeDuration());			i++;		}		System.out.println("end testFindAccountDetailsByMonth");	}	public static void main(String[] args) {		ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");		AccountTest at = (AccountTest) ac.getBean("accountTest");//		at.testFindAllAccounts();//		at.testFindAllAccountsByYear();//		at.testFindAccountDetails();		at.testFindAccountDetailsByMonth();	}}

⌨️ 快捷键说明

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