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

Class Person

src/test/java/org/assertj/core/test/Person.java:20–61  ·  view source on GitHub ↗

A person. @author Alex Ruiz

Source from the content-addressed store, hash-verified

18 * @author Alex Ruiz
19 */
20public class Person implements Comparable<Person> {
21
22 private final String name;
23
24 public Person(String name) {
25 this.name = name;
26 }
27
28 public String getName() {
29 return name;
30 }
31
32 @Override
33 public int hashCode() {
34 final int prime = 31;
35 int result = 1;
36 result = prime * result + ((name == null) ? 0 : name.hashCode());
37 return result;
38 }
39
40 @Override
41 public boolean equals(Object obj) {
42 if (this == obj) return true;
43 if (obj == null) return false;
44 if (getClass() != obj.getClass()) return false;
45 Person other = (Person) obj;
46 if (name == null) {
47 if (other.name != null) return false;
48 } else if (!name.equals(other.name)) return false;
49 return true;
50 }
51
52 @Override
53 public int compareTo(Person other) {
54 return name.compareTo(other.name);
55 }
56
57 @Override
58 public String toString() {
59 return String.format("Person[name='%s']", name);
60 }
61}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected