View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.rat.api.domain;
20  
21  import static org.apache.rat.api.domain.RatLicenseFamily.APACHE;
22  import static org.apache.rat.api.domain.RatLicenseFamily.CDDL1;
23  import static org.apache.rat.api.domain.RatLicenseFamily.DOJO;
24  import static org.apache.rat.api.domain.RatLicenseFamily.GPL1;
25  import static org.apache.rat.api.domain.RatLicenseFamily.GPL2;
26  import static org.apache.rat.api.domain.RatLicenseFamily.GPL3;
27  import static org.apache.rat.api.domain.RatLicenseFamily.MIT;
28  import static org.apache.rat.api.domain.RatLicenseFamily.OASIS;
29  import static org.apache.rat.api.domain.RatLicenseFamily.TMF854;
30  import static org.apache.rat.api.domain.RatLicenseFamily.W3C;
31  import static org.apache.rat.api.domain.RatLicenseFamily.W3C_DOCUMENTATION;
32  import static org.hamcrest.CoreMatchers.is;
33  import static org.junit.Assert.assertThat;
34  
35  import org.junit.Test;
36  
37  public class RatLicenseFamilyTest {
38  
39      @Test
40      public void testW3CLicenseFamilyCategory() {
41          assertThat(W3C.getCategory(), is("W3C  "));
42      }
43  
44      @Test
45      public void testW3CLicenseFamilyName() {
46          assertThat(W3C.getName(), is("W3C Software Copyright"));
47      }
48  
49      @Test
50      public void testW3CLicenseFamilyNotes() {
51          assertThat(
52                  W3C.getNotes(),
53                  is("Note that W3C requires a NOTICE. All modifications require notes. See http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231."));
54      }
55  
56      @Test
57      public void testW3CDocLicenseFamilyCategory() {
58          assertThat(W3C_DOCUMENTATION.getCategory(), is("W3CD "));
59      }
60  
61      @Test
62      public void testW3CDocLicenseFamilyName() {
63          assertThat(W3C_DOCUMENTATION.getName(), is("W3C Document Copyright"));
64      }
65  
66      @Test
67      public void testW3CDocLicenseFamilyNotes() {
68          assertThat(
69                  W3C_DOCUMENTATION.getNotes(),
70                  is("Note that W3CD does not allow modifications. See http://www.w3.org/Consortium/Legal/2002/copyright-documents-20021231."));
71      }
72  
73  	@Test
74  	public void testAPACHELicenseFamilyCategory() {
75  		assertThat(APACHE.getCategory(), is("AL   "));
76  	}
77  
78  	@Test
79  	public void testAPACHELicenseFamilyName() {
80  		assertThat(APACHE.getName(), is("Apache License Version 2.0"));
81  	}
82  
83  	@Test
84  	public void testAPACHELicenseFamilyNotes() {
85  		assertThat(
86  				APACHE.getNotes(),
87  				is("Note that APACHE requires a NOTICE. All modifications require notes. See http://www.apache.org/licenses/LICENSE-2.0."));
88  	}
89  
90  	@Test
91  	public void testGPL1LicenseFamilyCategory() {
92  		assertThat(GPL1.getCategory(), is("GPL1 "));
93  	}
94  
95  	@Test
96  	public void testGPL1LicenseFamilyName() {
97  		assertThat(GPL1.getName(), is("GNU General Public License, version 1"));
98  	}
99  
100 	@Test
101 	public void testGPL1LicenseFamilyNotes() {
102 		assertThat(
103 				GPL1.getNotes(),
104 				is("Note that GPL1 requires a NOTICE. All modifications require notes. See http://www.gnu.org/licenses/gpl-1.0.html."));
105 	}
106 
107 	@Test
108 	public void testGPL2LicenseFamilyCategory() {
109 		assertThat(GPL2.getCategory(), is("GPL2 "));
110 	}
111 
112 	@Test
113 	public void testGPL2LicenseFamilyName() {
114 		assertThat(GPL2.getName(), is("GNU General Public License, version 2"));
115 	}
116 
117 	@Test
118 	public void testGPL2LicenseFamilyNotes() {
119 		assertThat(
120 				GPL2.getNotes(),
121 				is("Note that GPL2 requires a NOTICE. All modifications require notes. See http://www.gnu.org/licenses/gpl-2.0.html."));
122 	}
123 
124 	@Test
125 	public void testGPL3LicenseFamilyCategory() {
126 		assertThat(GPL3.getCategory(), is("GPL3 "));
127 	}
128 
129 	@Test
130 	public void testGPL3LicenseFamilyName() {
131 		assertThat(GPL3.getName(), is("GNU General Public License, version 3"));
132 	}
133 
134 	@Test
135 	public void testGPL3LicenseFamilyNotes() {
136 		assertThat(
137 				GPL3.getNotes(),
138 				is("Note that GPL3 requires a NOTICE. All modifications require notes. See http://www.gnu.org/licenses/gpl-3.0.html."));
139 	}
140 
141 	@Test
142 	public void testMITLicenseFamilyCategory() {
143 		assertThat(MIT.getCategory(), is("MIT  "));
144 	}
145 
146 	@Test
147 	public void testMITLicenseFamilyName() {
148 		assertThat(MIT.getName(), is("The MIT License"));
149 	}
150 
151 	@Test
152 	public void testMITLicenseFamilyNotes() {
153 		assertThat(
154 				MIT.getNotes(),
155 				is("Note that MIT requires a NOTICE. All modifications require notes. See http://opensource.org/licenses/MIT."));
156 	}
157 
158 	@Test
159 	public void testCDDL1LicenseFamilyCategory() {
160 		assertThat(CDDL1.getCategory(), is("CDDL1"));
161 	}
162 
163 	@Test
164 	public void testCDDL1LicenseFamilyName() {
165 		assertThat(CDDL1.getName(),
166 				is("COMMON DEVELOPMENT AND DISTRIBUTION LICENSE Version 1.0"));
167 	}
168 
169 	@Test
170 	public void testCDDL1LicenseFamilyNotes() {
171 		assertThat(
172 				CDDL1.getNotes(),
173 				is("Note that CDDL1 requires a NOTICE. All modifications require notes. See https://oss.oracle.com/licenses/CDDL."));
174 	}
175 
176 	@Test
177 	public void testOASISLicenseFamilyCategory() {
178 		assertThat(OASIS.getCategory(), is("OASIS"));
179 	}
180 
181 	@Test
182 	public void testOASISLicenseFamilyName() {
183 		assertThat(OASIS.getName(), is("OASIS Open License"));
184 	}
185 
186 	@Test
187 	public void testOASISLicenseFamilyNotes() {
188 		assertThat(
189 				OASIS.getNotes(),
190 				is("Note that OASIS requires a NOTICE. All modifications require notes. See https://www.oasis-open.org/policies-guidelines/ipr."));
191 	}
192 	
193 	@Test
194 	public void testTMF854LicenseFamilyCategory() {
195 		assertThat(TMF854.getCategory(), is("TMF  "));
196 	}
197 
198 	@Test
199 	public void testTMF854LicenseFamilyName() {
200 		assertThat(TMF854.getName(), is("Modified BSD License"));
201 	}
202 
203 	@Test
204 	public void testTMF854LicenseFamilyNotes() {
205 		assertThat(
206 				TMF854.getNotes(),
207 				is("Note that TMF854 requires a NOTICE. All modifications require notes. See http://opensource.org/licenses/BSD-3-Clause."));
208 	}
209 	
210 	@Test
211 	public void testDOJOLicenseFamilyCategory() {
212 		assertThat(DOJO.getCategory(), is("DOJO "));
213 	}
214 
215 	@Test
216 	public void testDOJOLicenseFamilyName() {
217 		assertThat(DOJO.getName(), is("Modified BSD License"));
218 	}
219 
220 	@Test
221 	public void testDOJOLicenseFamilyNotes() {
222 		assertThat(
223 				DOJO.getNotes(),
224 				is("Note that DOJO requires a NOTICE. All modifications require notes. See http://dojotoolkit.org/community/licensing.shtml."));
225 	}
226 }