View Javadoc
1   package org.apache.rat.config;
2   
3   import org.apache.rat.api.MetaData;
4   import org.apache.rat.license.GPL1LicenseFamily;
5   import org.apache.rat.license.ILicenseFamily;
6   import org.junit.Test;
7   
8   import static org.junit.Assert.assertEquals;
9   import static org.junit.Assert.assertTrue;
10  
11  
12  /*
13   * Licensed to the Apache Software Foundation (ASF) under one
14   * or more contributor license agreements.  See the NOTICE file
15   * distributed with this work for additional information
16   * regarding copyright ownership.  The ASF licenses this file
17   * to you under the Apache License, Version 2.0 (the
18   * "License"); you may not use this file except in compliance
19   * with the License.  You may obtain a copy of the License at
20   *
21   *   http://www.apache.org/licenses/LICENSE-2.0
22   *
23   * Unless required by applicable law or agreed to in writing,
24   * software distributed under the License is distributed on an
25   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
26   * KIND, either express or implied.  See the License for the
27   * specific language governing permissions and limitations
28   * under the License.
29   */
30  public class ConfigurationUtilTest {
31      @Test
32      public void toNamesIsNullSafe() {
33          assertTrue(ConfigurationUtil.toNames(null).isEmpty());
34      }
35  
36      @Test
37      public void toNamesIsEmptyArraySafe() {
38          assertTrue(ConfigurationUtil.toNames(new ILicenseFamily[0]).isEmpty());
39      }
40      @Test
41      public void toNamesRegular() {
42          assertEquals(MetaData.RAT_LICENSE_FAMILY_NAME_VALUE_GPL_VERSION_1, ConfigurationUtil.toNames(new ILicenseFamily[]{new GPL1LicenseFamily()}).get(0));
43      }
44  }