Use Optional matcher

Change-Id: I55c4b12971b1a10f9248a5d2dce8686bf8d4177c
diff --git a/core/api/src/test/java/org/onosproject/net/behaviour/DefaultQueueDescriptionTest.java b/core/api/src/test/java/org/onosproject/net/behaviour/DefaultQueueDescriptionTest.java
index 6c495fb..99647cc 100644
--- a/core/api/src/test/java/org/onosproject/net/behaviour/DefaultQueueDescriptionTest.java
+++ b/core/api/src/test/java/org/onosproject/net/behaviour/DefaultQueueDescriptionTest.java
@@ -16,17 +16,15 @@
 
 package org.onosproject.net.behaviour;
 
-import java.util.EnumSet;
-
+import com.google.common.testing.EqualsTester;
 import org.junit.Test;
 import org.onlab.util.Bandwidth;
 
-import com.google.common.testing.EqualsTester;
+import java.util.EnumSet;
 
-import static org.hamcrest.Matchers.contains;
+import static com.spotify.hamcrest.optional.OptionalMatchers.optionalWithValue;
+import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
 
 
 public class DefaultQueueDescriptionTest {
@@ -71,17 +69,11 @@
 
     @Test
     public void testConstruction() {
-        assertTrue(queueDescription1.burst().isPresent());
-        assertThat(queueDescription1.burst().get(), is(1L));
-        assertTrue(queueDescription1.dscp().isPresent());
-        assertThat(queueDescription1.dscp().get(), is(11));
-        assertTrue(queueDescription1.maxRate().isPresent());
-        assertThat(queueDescription1.maxRate().get(), is(MAX_BANDWIDTH_1));
-        assertTrue(queueDescription1.minRate().isPresent());
-        assertThat(queueDescription1.minRate().get(), is(MIN_BANDWIDTH_1));
-        assertThat(queueDescription1.type(), contains(QueueDescription.Type.MAX));
-        assertTrue(queueDescription1.priority().isPresent());
-        assertThat(queueDescription1.priority().get(), is(1L));
+        assertThat(queueDescription1.burst(), optionalWithValue(is(1L)));
+        assertThat(queueDescription1.dscp(), optionalWithValue(is(11)));
+        assertThat(queueDescription1.maxRate(), optionalWithValue(is(MAX_BANDWIDTH_1)));
+        assertThat(queueDescription1.minRate(), optionalWithValue(is(MIN_BANDWIDTH_1)));
+        assertThat(queueDescription1.priority(), optionalWithValue(is(1L)));
         assertThat(queueDescription1.queueId(), is(QUEUE_ID1));
     }
 
diff --git a/core/api/src/test/java/org/onosproject/net/behaviour/DefaultTunnelDescriptionTest.java b/core/api/src/test/java/org/onosproject/net/behaviour/DefaultTunnelDescriptionTest.java
index 5cd339f..4d9e2b9 100644
--- a/core/api/src/test/java/org/onosproject/net/behaviour/DefaultTunnelDescriptionTest.java
+++ b/core/api/src/test/java/org/onosproject/net/behaviour/DefaultTunnelDescriptionTest.java
@@ -16,15 +16,14 @@
 
 package org.onosproject.net.behaviour;
 
+import com.google.common.testing.EqualsTester;
 import org.junit.Test;
 import org.onosproject.net.DefaultAnnotations;
 import org.onosproject.net.SparseAnnotations;
 
-import com.google.common.testing.EqualsTester;
-
+import static com.spotify.hamcrest.optional.OptionalMatchers.optionalWithValue;
 import static org.hamcrest.Matchers.is;
 import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
 
 
 public class DefaultTunnelDescriptionTest {
@@ -64,16 +63,12 @@
 
     @Test
     public void testConstruction() {
-        assertTrue(tunnelDescription1.deviceId().isPresent());
-        assertThat(tunnelDescription1.deviceId().get(), is(DID_1));
+        assertThat(tunnelDescription1.deviceId(), optionalWithValue(is(DID_1)));
         assertThat(tunnelDescription1.ifaceName(), is(IFACE_NAME_1));
-        assertTrue(tunnelDescription1.key().isPresent());
-        assertThat(tunnelDescription1.key().get(), is(KEY_1));
+        assertThat(tunnelDescription1.key(), optionalWithValue(is(KEY_1)));
         assertThat(tunnelDescription1.type(), is(TunnelDescription.Type.GRE));
-        assertTrue(tunnelDescription1.local().isPresent());
-        assertThat(tunnelDescription1.local().get(), is(LOCAL_1));
-        assertTrue(tunnelDescription1.remote().isPresent());
-        assertThat(tunnelDescription1.remote().get(), is(REMOTE_1));
+        assertThat(tunnelDescription1.local(), optionalWithValue(is(LOCAL_1)));
+        assertThat(tunnelDescription1.remote(), optionalWithValue(is(REMOTE_1)));
     }
 
     @Test