1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.model;
20
21 import org.junit.jupiter.api.Test;
22
23 import static org.junit.jupiter.api.Assertions.assertFalse;
24 import static org.junit.jupiter.api.Assertions.assertNotNull;
25 import static org.junit.jupiter.api.Assertions.assertTrue;
26
27
28
29
30
31
32 public class DeveloperTest {
33
34 @Test
35 public void testHashCodeNullSafe() {
36 new Developer().hashCode();
37 }
38
39 @Test
40 public void testEqualsNullSafe() {
41 assertFalse(new Developer().equals(null));
42
43 new Developer().equals(new Developer());
44 }
45
46 @Test
47 public void testEqualsIdentity() {
48 Developer thing = new Developer();
49 assertTrue(thing.equals(thing));
50 }
51
52 @Test
53 public void testToStringNullSafe() {
54 assertNotNull(new Developer().toString());
55 }
56
57 @Test
58 public void testToStringNotNonsense() {
59 Developer dev = new Developer();
60 dev.setName("Maven Tester");
61 dev.setEmail("tester@acme.localdomain");
62 dev.setId("20220118");
63
64 String s = dev.toString();
65
66 assert "Developer {id=20220118, Contributor {name=Maven Tester, email=tester@acme.localdomain}}".equals(s) : s;
67 }
68 }