博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
OGNL投影查询
阅读量:4046 次
发布时间:2019-05-25

本文共 3335 字,大约阅读时间需要 11 分钟。

四、附:测试类代码

1.Department

public class Department {

  

   private String departName;

   private List<Employee> empList;

  

   public Department() {

     

   }

 

   public Department(String departName, List<Employee> empList) {

      super();

      this.departName = departName;

      this.empList = empList;

   }

 

   @Override

   public String toString() {

      return "Department [departName=" + departName + ", empList=" + empList

            + "]";

   }

 

   public String getDepartName() {

      return departName;

   }

 

   public void setDepartName(String departName) {

      this.departName = departName;

   }

 

   public List<Employee> getEmpList() {

      return empList;

   }

 

   public void setEmpList(List<Employee> empList) {

      this.empList = empList;

   }

 

}

 

2.Employee类

public class Employee {

  

   private String empName;

   private Address address;

   private double salary;

 

   public Employee() {

     

   }

 

   public Employee(String empName, Address address, double salary) {

      super();

      this.empName = empName;

      this.address = address;

      this.salary = salary;

   }

 

   public double getSalary() {

      return salary;

   }

 

   public void setSalary(double salary) {

      this.salary = salary;

   }

 

   public String getEmpName() {

      return empName;

   }

 

   public void setEmpName(String empName) {

      this.empName = empName;

   }

 

   public Address getAddress() {

      return address;

   }

 

   public void setAddress(Address address) {

      this.address = address;

   }

 

   @Override

   public String toString() {

      return "Employee [empName=" + empName + ", address=" + address + "]";

   }

}

 

3.Address类

public class Address {

  

   private String country;

   private String province;

   private String city;

   private String street;

  

   public Address() {

     

   }

 

   public Address(String country, String province, String city, String street) {

      super();

      this.country = country;

      this.province = province;

      this.city = city;

      this.street = street;

   }

 

   public String getCountry() {

      return country;

   }

 

   public void setCountry(String country) {

      this.country = country;

   }

 

   public String getProvince() {

      return province;

   }

 

   public void setProvince(String province) {

      this.province = province;

   }

 

   public String getCity() {

      return city;

   }

 

   public void setCity(String city) {

      this.city = city;

   }

 

   public String getStreet() {

      return street;

   }

 

   public void setStreet(String street) {

      this.street = street;

   }

 

   @Override

   public String toString() {

      return "Address [country=" + country + ", province=" + province

            + ", city=" + city + ", street=" + street + "]";

   }

  

}

 

4.GetData类

public class GetData {

  

   public static List<Department> getDepartList() {

      List<Department> departList = new ArrayList<>();

     

      List<Employee> empList = new ArrayList<>();

     

      for(int i = 1; i <= 20; i++) {

         Employee employee = new Employee("emp"+String.format("%02d", i), new Address("country"+String.format("%02d", i), "prov"+String.format("%02d", i), "city"+String.format("%02d", i), "street"+String.format("%02d", i)),i*100.00);

         empList.add(employee);

      }

     

      Department department01 = new Department("depart01", empList.subList(0, 4));

      Department department02 = new Department("depart02", empList.subList(4, 8));

      Department department03 = new Department("depart03", empList.subList(8, 12));

      Department department04 = new Department("depart04", empList.subList(12, 16));

      Department department05 = new Department("depart05", empList.subList(16, 20));

     

      departList.add(department01);

      departList.add(department02);

      departList.add(department03);

      departList.add(department04);

      departList.add(department05);

     

      return departList;

   }

  

 

}

 

 

 

本教程由尚硅谷教育大数据研究院出品,如需转载请注明来源。

你可能感兴趣的文章
移动端自动化测试-Windows-Android-Appium环境搭建
查看>>
Xpath使用方法
查看>>
移动端自动化测试-Mac-IOS-Appium环境搭建
查看>>
Selenium之前世今生
查看>>
Selenium-WebDriverApi接口详解
查看>>
Selenium-ActionChains Api接口详解
查看>>
Selenium-Switch与SelectApi接口详解
查看>>
Selenium-Css Selector使用方法
查看>>
Linux常用统计命令之wc
查看>>
测试必会之 Linux 三剑客之 sed
查看>>
Socket请求XML客户端程序
查看>>
Java中数字转大写货币(支持到千亿)
查看>>
Java.nio
查看>>
函数模版类模版和偏特化泛化的总结
查看>>
VMware Workstation Pro虚拟机不可用解决方法
查看>>
最简单的使用redis自带程序实现c程序远程访问redis服务
查看>>
redis学习总结-- 内部数据 字符串 链表 字典 跳跃表
查看>>
iOS 对象序列化与反序列化
查看>>
iOS 序列化与反序列化(runtime) 01
查看>>
iOS AFN 3.0版本前后区别 01
查看>>