MCPcopy Index your code
hub / github.com/assertj/assertj / Employee

Class Employee

src/test/java/org/assertj/core/test/Employee.java:21–65  ·  view source on GitHub ↗

@author Yvonne Wang @author Joel Costigliola

Source from the content-addressed store, hash-verified

19 * @author Joel Costigliola
20 */
21public class Employee {
22
23 // intentionally public to test retrieval of a public field that is not a property
24 public long id;
25 // name is both a public field and a property => will be accessed as a property by extracting code
26 public Name name;
27 // surname is only a public field
28 public Name surname;
29 // keep private to test we are able to read property that is not a public field
30 private int age;
31
32 public Employee() {}
33
34 public Employee(long id, Name name, int age) {
35 this.id = id;
36 setName(name);
37 setAge(age);
38 }
39
40 public Name getName() {
41 return name;
42 }
43
44 public void setName(Name name) {
45 this.name = name;
46 }
47
48 public int getAge() {
49 return age;
50 }
51
52 public void setAge(int age) {
53 this.age = age;
54 }
55
56 // pure property not backed by a field
57 public boolean isAdult() {
58 return age > 18;
59 }
60
61 @Override
62 public String toString() {
63 return format("%s[id=%d, name=%s, age=%d]", getClass().getSimpleName(), id, name, age);
64 }
65}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected