📄 accounttest.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -