Project

General

Profile

« Previous | Next » 

Revision c1f123ee

Added by Ayco Hollemann about 10 years ago

Refined unit testing for EntityValidationTask and ValidationExecutor

View differences:

cdmlib-persistence/src/test/java/eu/etaxonomy/cdm/persistence/validation/Employee.java
2 2

  
3 3
import java.util.List;
4 4

  
5
import javax.validation.Valid;
6

  
5 7
import eu.etaxonomy.cdm.model.common.CdmBase;
6 8
import eu.etaxonomy.cdm.validation.Level2;
7

  
9
import eu.etaxonomy.cdm.validation.Level3;
10

  
11
/**
12
 * A Mock class for testing entity validation tasks.
13
 * 
14
 * @author ayco_holleman
15
 * 
16
 */
8 17
@SuppressWarnings("serial")
9 18
public class Employee extends CdmBase {
10 19

  
11
	@LongRunningCheckCase(value = CaseMode.UPPER, groups = { Level2.class })
20
	@CheckCase(value = CaseMode.UPPER, groups = { Level2.class })
12 21
	private String firstName;
22
	@CheckCase(value = CaseMode.UPPER, groups = { Level3.class })
13 23
	private String lastName;
14
	private int age;
15
	private double salary;
24
	@Valid
16 25
	private Company company;
26
	@Valid
17 27
	List<Address> addresses;
18 28

  
19 29

  
20
	public Employee(Company company)
21
	{
22
		this.company = company;
23
	}
24

  
25

  
26 30
	public Employee()
27 31
	{
28 32
	}
......
52 56
	}
53 57

  
54 58

  
55
	public int getAge()
56
	{
57
		return age;
58
	}
59

  
60

  
61
	public void setAge(int age)
62
	{
63
		this.age = age;
64
	}
65

  
66

  
67
	public double getSalary()
68
	{
69
		return salary;
70
	}
71

  
72

  
73
	public void setSalary(double salary)
74
	{
75
		this.salary = salary;
76
	}
77

  
78

  
79 59
	public Company getCompany()
80 60
	{
81 61
		return company;
......
112 92
		return firstName.equals(emp.firstName) && lastName.equals(emp.lastName);
113 93
	}
114 94

  
95

  
96
	public int hashCode()
97
	{
98
		int hash = 17;
99
		hash = (hash * 31) + firstName.hashCode();
100
		hash = (hash * 31) + lastName.hashCode();
101
		return hash;
102
	}
103

  
115 104
}

Also available in: Unified diff