Han-Wen Nienhuys | 3428dc9 | 2015-10-21 15:03:34 +0000 | [diff] [blame] | 1 | // Copyright 2015 The Bazel Authors. All rights reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | package com.google.devtools.build.lib.packages; |
| 15 | |
lberki | aea56b3 | 2017-05-30 12:35:33 +0200 | [diff] [blame^] | 16 | import static com.google.common.truth.Truth.assertThat; |
Han-Wen Nienhuys | 3428dc9 | 2015-10-21 15:03:34 +0000 | [diff] [blame] | 17 | |
| 18 | import com.google.devtools.build.lib.packages.License.LicenseType; |
lberki | aea56b3 | 2017-05-30 12:35:33 +0200 | [diff] [blame^] | 19 | import java.util.Arrays; |
Han-Wen Nienhuys | 3428dc9 | 2015-10-21 15:03:34 +0000 | [diff] [blame] | 20 | import org.junit.Test; |
| 21 | import org.junit.runner.RunWith; |
| 22 | import org.junit.runners.JUnit4; |
| 23 | |
Han-Wen Nienhuys | 3428dc9 | 2015-10-21 15:03:34 +0000 | [diff] [blame] | 24 | @RunWith(JUnit4.class) |
| 25 | public class LicenseTest { |
| 26 | |
| 27 | @Test |
| 28 | public void testLeastRestrictive() { |
lberki | aea56b3 | 2017-05-30 12:35:33 +0200 | [diff] [blame^] | 29 | assertThat(License.leastRestrictive(Arrays.asList(LicenseType.RESTRICTED))) |
| 30 | .isEqualTo(LicenseType.RESTRICTED); |
| 31 | assertThat( |
| 32 | License.leastRestrictive( |
| 33 | Arrays.asList(LicenseType.RESTRICTED, LicenseType.BY_EXCEPTION_ONLY))) |
| 34 | .isEqualTo(LicenseType.RESTRICTED); |
| 35 | assertThat(License.leastRestrictive(Arrays.<LicenseType>asList())) |
| 36 | .isEqualTo(LicenseType.BY_EXCEPTION_ONLY); |
Han-Wen Nienhuys | 3428dc9 | 2015-10-21 15:03:34 +0000 | [diff] [blame] | 37 | } |
| 38 | } |