blob: 845f0b519cf8dece523147b7349cc96d86f3fd86 [file] [log] [blame]
Han-Wen Nienhuys3428dc92015-10-21 15:03:34 +00001// 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.
14package com.google.devtools.build.lib.packages;
15
lberkiaea56b32017-05-30 12:35:33 +020016import static com.google.common.truth.Truth.assertThat;
Han-Wen Nienhuys3428dc92015-10-21 15:03:34 +000017
18import com.google.devtools.build.lib.packages.License.LicenseType;
lberkiaea56b32017-05-30 12:35:33 +020019import java.util.Arrays;
Han-Wen Nienhuys3428dc92015-10-21 15:03:34 +000020import org.junit.Test;
21import org.junit.runner.RunWith;
22import org.junit.runners.JUnit4;
23
Han-Wen Nienhuys3428dc92015-10-21 15:03:34 +000024@RunWith(JUnit4.class)
25public class LicenseTest {
26
27 @Test
28 public void testLeastRestrictive() {
lberkiaea56b32017-05-30 12:35:33 +020029 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 Nienhuys3428dc92015-10-21 15:03:34 +000037 }
38}