blob: 15aca45a30a2d309c577ac15590cb9ea18bd2dde [file] [log] [blame]
Ray Milkey73ba84a2015-02-04 17:08:41 -08001/*
2 * Copyright 2015 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 */
16package org.onosproject.codec.impl;
17
18import java.util.EnumMap;
19
20import org.junit.Test;
21import org.onosproject.net.flow.criteria.Criterion;
22
23import static org.onlab.junit.TestUtils.getField;
24import static org.hamcrest.MatcherAssert.assertThat;
25import static org.hamcrest.Matchers.*;
26
27/**
28 * Unit tests for criterion codec.
29 */
30public class CriterionCodecTest {
31
32 /**
33 * Checks that all criterion types are covered by the codec.
34 */
35 @Test
36 public void checkCriterionTypes() throws Exception {
37 CriterionCodec codec = new CriterionCodec();
38 EnumMap<Criterion.Type, Object> formatMap = getField(codec, "formatMap");
39 assertThat(formatMap, notNullValue());
40
41 for (Criterion.Type type : Criterion.Type.values()) {
42 assertThat("Entry not found for " + type.toString(),
43 formatMap.get(type), notNullValue());
44 }
45 }
46}