Initial P4Runtime unit tests

Change-Id: I167fdd005f20ac8df00dd6e252f928896a4809c4
diff --git a/protocols/p4runtime/model/src/test/java/org/onosproject/p4runtime/model/P4MatchFieldModelTest.java b/protocols/p4runtime/model/src/test/java/org/onosproject/p4runtime/model/P4MatchFieldModelTest.java
new file mode 100644
index 0000000..448dcc5
--- /dev/null
+++ b/protocols/p4runtime/model/src/test/java/org/onosproject/p4runtime/model/P4MatchFieldModelTest.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.p4runtime.model;
+
+import com.google.common.testing.EqualsTester;
+import org.junit.Test;
+import org.onosproject.net.pi.model.PiMatchFieldId;
+import org.onosproject.net.pi.model.PiMatchType;
+import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
+
+/**
+ * Unit tests for P4MatchFieldModel class.
+ */
+public class P4MatchFieldModelTest {
+
+    private static final PiMatchFieldId PI_MATCH_FIELD_ID_1 = PiMatchFieldId.of("MatchField1");
+    private static final PiMatchFieldId PI_MATCH_FIELD_ID_2 = PiMatchFieldId.of("MatchField2");
+
+    private static final int BIT_WIDTH_1 = 100;
+    private static final int BIT_WIDTH_2 = 200;
+
+    private static final PiMatchType PI_MATCH_TYPE_1 = PiMatchType.EXACT;
+    private static final PiMatchType PI_MATCH_TYPE_2 = PiMatchType.TERNARY;
+
+    private static final P4MatchFieldModel P4_MATCH_FIELD_MODEL_1 =
+        new P4MatchFieldModel(PI_MATCH_FIELD_ID_1, BIT_WIDTH_1, PI_MATCH_TYPE_1);
+    private static final P4MatchFieldModel SAME_AS_P4_MATCH_FIELD_MODEL_1 =
+        new P4MatchFieldModel(PI_MATCH_FIELD_ID_1, BIT_WIDTH_1, PI_MATCH_TYPE_1);
+    private static final P4MatchFieldModel P4_MATCH_FIELD_MODEL_2 =
+        new P4MatchFieldModel(PI_MATCH_FIELD_ID_2, BIT_WIDTH_2, PI_MATCH_TYPE_2);
+
+    /**
+     * Checks that the P4MatchFieldModel class is immutable.
+     */
+    @Test
+    public void testImmutability() {
+        assertThatClassIsImmutable(P4MatchFieldModel.class);
+    }
+
+    /**
+     * Checks the operation of equals(), hashCode() and toString() methods.
+     */
+    @Test
+    public void testEquals() {
+        new EqualsTester()
+            .addEqualityGroup(P4_MATCH_FIELD_MODEL_1, SAME_AS_P4_MATCH_FIELD_MODEL_1)
+            .addEqualityGroup(P4_MATCH_FIELD_MODEL_2)
+            .testEquals();
+    }
+}
\ No newline at end of file