2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * Modifications Copyright (C) 2018 Nokia. All rights reserved.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.vid.testUtils;
24 import org.junit.Test;
25 import org.onap.vid.utils.Intersection;
27 import java.util.List;
29 import static org.assertj.core.api.Assertions.assertThat;
30 import static org.assertj.core.util.Lists.emptyList;
31 import static org.assertj.core.util.Lists.list;
33 public class IntersectionTest {
36 public void testFourArrays() {
38 List<List<String>> input = list(
45 List<String> output = Intersection.of(input);
47 assertThat(output).containsExactlyInAnyOrder("2");
52 public void testTwoArrays() {
54 List<List<String>> input = list(
59 List<String> output = Intersection.of(input);
61 assertThat(output).containsExactlyInAnyOrder("2");
67 public void testNoIntersection() {
69 List<List<String>> input = list(
74 List<String> output = Intersection.of(input);
76 assertThat(output).isEmpty();
81 public void testOneArray() {
83 List<List<String>> input = list(list("1", "2"));
85 List<String> output = Intersection.of(input);
87 assertThat(output).containsExactlyInAnyOrder("1", "2");
91 public void testEmptyInput() {
93 List<String> output = Intersection.of(emptyList());
95 assertThat(output).isEmpty();
99 public void shouldIgnoreRepetitions() {
101 List<String> output = Intersection.of(list(
106 assertThat(output).containsExactly("1");