blob: f9775b901d88b340394701699b6c282fac2ccf1c [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2014-present Open Networking Laboratory
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.net.intent;
Brian O'Connorf3d06162014-10-02 15:54:12 -070017
Brian O'Connorf3d06162014-10-02 15:54:12 -070018import java.util.Arrays;
19import java.util.HashSet;
20import java.util.Set;
21
Brian O'Connorf3d06162014-10-02 15:54:12 -070022/**
23 * Base facilities to test various intent tests.
24 */
Brian O'Connor520c0522014-11-23 23:50:47 -080025public abstract class IntentTest extends AbstractIntentTest {
Brian O'Connorf3d06162014-10-02 15:54:12 -070026 /**
27 * Produces a set of items from the supplied items.
28 *
29 * @param items items to be placed in set
30 * @param <T> item type
31 * @return set of items
32 */
33 protected static <T> Set<T> itemSet(T[] items) {
34 return new HashSet<>(Arrays.asList(items));
35 }
36
Brian O'Connorf3d06162014-10-02 15:54:12 -070037 /**
38 * Creates a new intent, but always a like intent, i.e. all instances will
39 * be equal, but should not be the same.
40 *
41 * @return intent
42 */
43 protected abstract Intent createOne();
44
45 /**
46 * Creates another intent, not equals to the one created by
47 * {@link #createOne()} and with a different hash code.
48 *
49 * @return another intent
50 */
51 protected abstract Intent createAnother();
52}