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 LicenseTest {
33
34 @Test
35 public void testHashCodeNullSafe() {
36 new License().hashCode();
37 }
38
39 @Test
40 public void testEqualsNullSafe() {
41 assertFalse(new License().equals(null));
42
43 new License().equals(new License());
44 }
45
46 @Test
47 public void testEqualsIdentity() {
48 License thing = new License();
49 assertTrue(thing.equals(thing));
50 }
51
52 @Test
53 public void testToStringNullSafe() {
54 assertNotNull(new License().toString());
55 }
56
57 @Test
58 public void testToStringNotNonsense() {
59 License license = new License();
60 license.setName("Unlicense");
61 license.setUrl("http://lic.localdomain");
62
63 String s = license.toString();
64
65 assert "License {name=Unlicense, url=http://lic.localdomain}".equals(s) : s;
66 }
67 }