Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 Open Networking Laboratory |
| 3 | * |
| 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'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.net.intent; |
Brian O'Connor | f3d0616 | 2014-10-02 15:54:12 -0700 | [diff] [blame] | 17 | |
Brian O'Connor | f3d0616 | 2014-10-02 15:54:12 -0700 | [diff] [blame] | 18 | import java.util.Arrays; |
| 19 | import java.util.HashSet; |
| 20 | import java.util.Set; |
| 21 | |
Brian O'Connor | f3d0616 | 2014-10-02 15:54:12 -0700 | [diff] [blame] | 22 | /** |
| 23 | * Base facilities to test various intent tests. |
| 24 | */ |
Brian O'Connor | 520c052 | 2014-11-23 23:50:47 -0800 | [diff] [blame] | 25 | public abstract class IntentTest extends AbstractIntentTest { |
Brian O'Connor | f3d0616 | 2014-10-02 15:54:12 -0700 | [diff] [blame] | 26 | /** |
| 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'Connor | f3d0616 | 2014-10-02 15:54:12 -0700 | [diff] [blame] | 37 | /** |
| 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 | } |