blob: f0fb070f50487a4689a93f89734e93e168c415f5 [file] [log] [blame]
Ray Milkey540b2ce2015-02-04 17:50:20 -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 org.junit.Test;
19import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
20import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutableBaseClass;
21
22/**
23 * Tests to assure that the codec classes follow the contract of having
24 * no local context.
25 */
26public class ImmutableCodecsTest {
27
28 /**
29 * Checks that the codec classes adhere to the contract that there cannot
30 * be any local context in a codec.
31 */
32 @Test
33 public void checkImmutability() {
34 assertThatClassIsImmutableBaseClass(AnnotatedCodec.class);
35 assertThatClassIsImmutable(AnnotationsCodec.class);
36 assertThatClassIsImmutable(ApplicationCodec.class);
37 assertThatClassIsImmutable(ConnectivityIntentCodec.class);
38 assertThatClassIsImmutable(ConnectPointCodec.class);
39 assertThatClassIsImmutable(ConstraintCodec.class);
40 assertThatClassIsImmutable(CriterionCodec.class);
41 assertThatClassIsImmutable(DeviceCodec.class);
42 assertThatClassIsImmutable(EthernetCodec.class);
43 assertThatClassIsImmutable(FlowEntryCodec.class);
44 assertThatClassIsImmutable(HostCodec.class);
45 assertThatClassIsImmutable(HostLocationCodec.class);
46 assertThatClassIsImmutable(HostToHostIntentCodec.class);
47 assertThatClassIsImmutable(InstructionCodec.class);
48 assertThatClassIsImmutable(IntentCodec.class);
49 assertThatClassIsImmutable(LinkCodec.class);
50 assertThatClassIsImmutable(PathCodec.class);
51 assertThatClassIsImmutable(PointToPointIntentCodec.class);
52 assertThatClassIsImmutable(PortCodec.class);
53 assertThatClassIsImmutable(TopologyClusterCodec.class);
54 assertThatClassIsImmutable(TopologyCodec.class);
55 assertThatClassIsImmutable(TrafficSelectorCodec.class);
56 assertThatClassIsImmutable(TrafficTreatmentCodec.class);
57 }
58}