Improve coverage for some classes

- DefaultPatchDescription
- BridgeName
- DefaultQosDescription
- AbstractPathService

Change-Id: Ic2fad1d94578555701c1c1d1fc2e9a8cb167de84
diff --git a/core/api/src/main/java/org/onosproject/net/behaviour/DefaultPatchDescription.java b/core/api/src/main/java/org/onosproject/net/behaviour/DefaultPatchDescription.java
index 8d13c68..9450f39 100644
--- a/core/api/src/main/java/org/onosproject/net/behaviour/DefaultPatchDescription.java
+++ b/core/api/src/main/java/org/onosproject/net/behaviour/DefaultPatchDescription.java
@@ -20,6 +20,7 @@
 import org.onosproject.net.AbstractDescription;
 import org.onosproject.net.SparseAnnotations;
 
+import java.util.Objects;
 import java.util.Optional;
 
 import static com.google.common.base.Preconditions.checkArgument;
@@ -61,6 +62,26 @@
     }
 
     @Override
+    public int hashCode() {
+        return Objects.hash(deviceId, ifaceName, peerName);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof DefaultPatchDescription) {
+            final DefaultPatchDescription that = (DefaultPatchDescription) obj;
+            return this.getClass() == that.getClass() &&
+                    Objects.equals(this.deviceId, that.deviceId) &&
+                    Objects.equals(this.ifaceName, that.ifaceName) &&
+                    Objects.equals(this.peerName, that.peerName);
+        }
+        return false;
+    }
+
+    @Override
     public String toString() {
         return MoreObjects.toStringHelper(this)
                 .add("deviceId", deviceId)
diff --git a/core/api/src/test/java/org/onosproject/net/behaviour/BridgeNameTest.java b/core/api/src/test/java/org/onosproject/net/behaviour/BridgeNameTest.java
new file mode 100644
index 0000000..ad23c9a
--- /dev/null
+++ b/core/api/src/test/java/org/onosproject/net/behaviour/BridgeNameTest.java
@@ -0,0 +1,52 @@
+/*
+ * 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.net.behaviour;
+
+import org.junit.Test;
+
+import com.google.common.testing.EqualsTester;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
+
+public class BridgeNameTest {
+
+    private static final String NAME1 = "bridge-1";
+    private static final String NAME2 = "bridge-2";
+    private BridgeName bridgeName1 = BridgeName.bridgeName(NAME1);
+    private BridgeName sameAsBridgeName1 = BridgeName.bridgeName(NAME1);
+    private BridgeName bridgeName2 = BridgeName.bridgeName(NAME2);
+
+    @Test
+    public void testImmutability() {
+        assertThatClassIsImmutable(BridgeName.class);
+    }
+
+    @Test
+    public void testConstruction() {
+        assertThat(bridgeName1.name(), is(NAME1));
+    }
+
+    @Test
+    public void testEquals() {
+        new EqualsTester()
+                .addEqualityGroup(bridgeName1, sameAsBridgeName1)
+                .addEqualityGroup(bridgeName2)
+                .testEquals();
+    }
+
+}
diff --git a/core/api/src/test/java/org/onosproject/net/behaviour/DefaultPatchDescriptionTest.java b/core/api/src/test/java/org/onosproject/net/behaviour/DefaultPatchDescriptionTest.java
new file mode 100644
index 0000000..34c4521
--- /dev/null
+++ b/core/api/src/test/java/org/onosproject/net/behaviour/DefaultPatchDescriptionTest.java
@@ -0,0 +1,92 @@
+/*
+ * 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.net.behaviour;
+
+import org.junit.Test;
+
+import com.google.common.testing.EqualsTester;
+
+import static com.spotify.hamcrest.optional.OptionalMatchers.optionalWithValue;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
+
+
+public class DefaultPatchDescriptionTest {
+
+    private String deviceId1 = "d1";
+    private String ifaceName1 = "i1";
+    private String peerName1 = "p1";
+
+    private PatchDescription defaultPatchDescription1 =
+            DefaultPatchDescription.builder()
+            .deviceId(deviceId1)
+            .ifaceName(ifaceName1)
+            .peer(peerName1)
+            .build();
+    private PatchDescription sameAsDefaultPatchDescription1 =
+            DefaultPatchDescription.builder()
+                    .deviceId(deviceId1)
+                    .ifaceName(ifaceName1)
+                    .peer(peerName1)
+                    .build();
+    private PatchDescription defaultPatchDescription2 =
+            DefaultPatchDescription.builder()
+                    .deviceId(deviceId1 + "2")
+                    .ifaceName(ifaceName1)
+                    .peer(peerName1)
+                    .build();
+    private PatchDescription defaultPatchDescription3 =
+            DefaultPatchDescription.builder()
+                    .deviceId(deviceId1)
+                    .ifaceName(ifaceName1 + "2")
+                    .peer(peerName1)
+                    .build();
+    private PatchDescription defaultPatchDescription4 =
+            DefaultPatchDescription.builder()
+                    .deviceId(deviceId1)
+                    .ifaceName(ifaceName1)
+                    .peer(peerName1 + "2")
+                    .build();
+    private PatchDescription defaultPatchDescriptionNoDeviceId =
+            DefaultPatchDescription.builder()
+                    .ifaceName(ifaceName1)
+                    .peer(peerName1 + "2")
+                    .build();
+
+    @Test
+    public void testImmutability() {
+        assertThatClassIsImmutable(DefaultPatchDescription.class);
+    }
+
+    @Test
+    public void testConstruction() {
+        assertThat(defaultPatchDescription1.deviceId(), optionalWithValue(is(deviceId1)));
+        assertThat(defaultPatchDescription1.ifaceName(), is(ifaceName1));
+        assertThat(defaultPatchDescription1.peer(), is(peerName1));
+    }
+
+    @Test
+    public void testEquals() {
+        new EqualsTester()
+                .addEqualityGroup(defaultPatchDescription1, sameAsDefaultPatchDescription1)
+                .addEqualityGroup(defaultPatchDescription2)
+                .addEqualityGroup(defaultPatchDescription3)
+                .addEqualityGroup(defaultPatchDescription4)
+                .addEqualityGroup(defaultPatchDescriptionNoDeviceId)
+                .testEquals();
+    }
+}
diff --git a/core/api/src/test/java/org/onosproject/net/behaviour/DefaultQosDescriptionTest.java b/core/api/src/test/java/org/onosproject/net/behaviour/DefaultQosDescriptionTest.java
new file mode 100644
index 0000000..8196d74
--- /dev/null
+++ b/core/api/src/test/java/org/onosproject/net/behaviour/DefaultQosDescriptionTest.java
@@ -0,0 +1,125 @@
+/*
+ * 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.net.behaviour;
+
+import java.util.Map;
+
+import org.junit.Test;
+import org.onlab.util.Bandwidth;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.testing.EqualsTester;
+
+import static com.spotify.hamcrest.optional.OptionalMatchers.optionalWithValue;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
+
+public class DefaultQosDescriptionTest {
+
+    private QosId qosId1 = QosId.qosId("1");
+    private Bandwidth bandwidth1 = Bandwidth.bps(1);
+    private Map<Long, QueueDescription> queues1 = ImmutableMap.of();
+
+    private QosDescription defaultQosDescription1 =
+            DefaultQosDescription.builder()
+                    .qosId(qosId1)
+                    .cbs(1L)
+                    .cir(11L)
+                    .maxRate(bandwidth1)
+                    .queues(queues1)
+                    .type(QosDescription.Type.NOOP)
+                    .build();
+    private QosDescription sameAsDefaultQosDescription1 =
+            DefaultQosDescription.builder()
+                    .qosId(qosId1)
+                    .cbs(1L)
+                    .cir(11L)
+                    .maxRate(bandwidth1)
+                    .queues(queues1)
+                    .type(QosDescription.Type.NOOP)
+                    .build();
+    private QosDescription defaultQosDescription2 =
+            DefaultQosDescription.builder()
+                    .qosId(qosId1)
+                    .cbs(2L)
+                    .cir(11L)
+                    .maxRate(bandwidth1)
+                    .queues(queues1)
+                    .type(QosDescription.Type.NOOP)
+                    .build();
+    private QosDescription defaultQosDescription3 =
+            DefaultQosDescription.builder()
+                    .qosId(qosId1)
+                    .cbs(1L)
+                    .cir(33L)
+                    .maxRate(bandwidth1)
+                    .queues(queues1)
+                    .type(QosDescription.Type.NOOP)
+                    .build();
+    private QosDescription defaultQosDescription4 =
+            DefaultQosDescription.builder()
+                    .qosId(qosId1)
+                    .cbs(1L)
+                    .cir(11L)
+                    .queues(queues1)
+                    .type(QosDescription.Type.NOOP)
+                    .build();
+    private QosDescription defaultQosDescription5 =
+            DefaultQosDescription.builder()
+                    .qosId(qosId1)
+                    .cbs(1L)
+                    .cir(11L)
+                    .maxRate(bandwidth1)
+                    .type(QosDescription.Type.NOOP)
+                    .build();
+    private QosDescription defaultQosDescription6 =
+            DefaultQosDescription.builder()
+                    .qosId(qosId1)
+                    .cbs(1L)
+                    .cir(11L)
+                    .maxRate(bandwidth1)
+                    .queues(queues1)
+                    .type(QosDescription.Type.CODEL)
+                    .build();
+
+    @Test
+    public void testImmutability() {
+        assertThatClassIsImmutable(DefaultQosDescription.class);
+    }
+
+    @Test
+    public void testConstruction() {
+        assertThat(defaultQosDescription1.qosId(), is(qosId1));
+        assertThat(defaultQosDescription1.cbs(), optionalWithValue(is(1L)));
+        assertThat(defaultQosDescription1.cir(), optionalWithValue(is(11L)));
+        assertThat(defaultQosDescription1.maxRate(), optionalWithValue(is(bandwidth1)));
+        assertThat(defaultQosDescription1.queues(), optionalWithValue(is(queues1)));
+        assertThat(defaultQosDescription1.type(), is(QosDescription.Type.NOOP));
+    }
+
+    @Test
+    public void testEquals() {
+        new EqualsTester()
+                .addEqualityGroup(defaultQosDescription1, sameAsDefaultQosDescription1)
+                .addEqualityGroup(defaultQosDescription2)
+                .addEqualityGroup(defaultQosDescription3)
+                .addEqualityGroup(defaultQosDescription4)
+                .addEqualityGroup(defaultQosDescription5)
+                .addEqualityGroup(defaultQosDescription6)
+                .testEquals();
+    }
+}
diff --git a/core/api/src/test/java/org/onosproject/net/topology/AbstractPathServiceTest.java b/core/api/src/test/java/org/onosproject/net/topology/AbstractPathServiceTest.java
new file mode 100644
index 0000000..d8d14e9
--- /dev/null
+++ b/core/api/src/test/java/org/onosproject/net/topology/AbstractPathServiceTest.java
@@ -0,0 +1,269 @@
+/*
+ * 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.net.topology;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onlab.graph.ScalarWeight;
+import org.onlab.graph.Weight;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.DefaultDisjointPath;
+import org.onosproject.net.DefaultLink;
+import org.onosproject.net.DefaultPath;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.DisjointPath;
+import org.onosproject.net.ElementId;
+import org.onosproject.net.HostId;
+import org.onosproject.net.Link;
+import org.onosproject.net.NetTestTools;
+import org.onosproject.net.Path;
+import org.onosproject.net.host.HostServiceAdapter;
+import org.onosproject.net.provider.ProviderId;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.empty;
+import static org.hamcrest.Matchers.hasSize;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.not;
+import static org.hamcrest.Matchers.notNullValue;
+import static org.hamcrest.Matchers.nullValue;
+import static org.onosproject.net.NetTestTools.did;
+import static org.onosproject.net.NetTestTools.hid;
+
+public class AbstractPathServiceTest {
+
+    private TestPathService service;
+    private FakeTopoMgr topoMgr;
+
+    private ConnectPoint cpA = NetTestTools.connectPoint("A", 1);
+    private ConnectPoint cpB = NetTestTools.connectPoint("B", 2);
+    private ConnectPoint cpC = NetTestTools.connectPoint("C", 3);
+    private ProviderId pid = ProviderId.NONE;
+    private Link link1 = DefaultLink.builder()
+            .providerId(pid)
+            .src(cpA)
+            .dst(cpB)
+            .type(Link.Type.DIRECT)
+            .state(Link.State.ACTIVE)
+            .build();
+    private Link link2 = DefaultLink.builder()
+            .providerId(pid)
+            .src(cpB)
+            .dst(cpC)
+            .type(Link.Type.DIRECT)
+            .state(Link.State.ACTIVE)
+            .build();
+    private List<Link> links1 = ImmutableList.of(link1, link2);
+    private Path path1 = new DefaultPath(pid, links1, new ScalarWeight(1.0));
+
+
+
+    private class TestPathService extends AbstractPathService {
+        Set<Path> paths = null;
+        Set<DisjointPath> disjointPaths = null;
+
+        @Override
+        public Set<Path> getPaths(ElementId src, ElementId dst) {
+            return paths;
+        }
+
+        @Override
+        public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst) {
+            return disjointPaths;
+        }
+
+        @Override
+        public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst, Map<Link, Object> riskProfile) {
+            return disjointPaths;
+        }
+    }
+
+    class TestWeigher implements LinkWeigher {
+        @Override
+        public Weight weight(TopologyEdge edge) {
+            return new ScalarWeight(1.0);
+        }
+
+        @Override
+        public Weight getInitialWeight() {
+            return new ScalarWeight(1.0);
+        }
+
+        @Override
+        public Weight getNonViableWeight() {
+            return new ScalarWeight(0.0);
+        }
+    }
+
+    // Fake entity to give out paths.
+    private class FakeTopoMgr extends TopologyServiceAdapter {
+
+        Set<Path> paths = new HashSet<>();
+        Set<DisjointPath> disjointPaths = new HashSet<>();
+
+        void definePaths(Set<Path> paths) {
+            this.paths = paths;
+            this.disjointPaths = paths.stream()
+                    .map(path ->
+                        new DefaultDisjointPath(path.providerId(),
+                                                (DefaultPath) path))
+                    .collect(Collectors.toSet());
+        }
+
+        @Override
+        public Set<Path> getPaths(Topology topology, DeviceId src,
+                                  DeviceId dst) {
+            return paths;
+        }
+
+        @Override
+        public Set<Path> getPaths(Topology topology, DeviceId src,
+                                  DeviceId dst, LinkWeigher weight) {
+            return paths;
+        }
+
+        @Override
+        public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src,
+                                                  DeviceId dst,
+                                                  LinkWeigher weigher) {
+            return disjointPaths;
+        }
+
+        @Override
+        public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src,
+                                                  DeviceId dst,
+                                                  LinkWeigher weigher,
+                                                  Map<Link, Object> riskProfile) {
+            return disjointPaths;
+        }
+    }
+
+    @Before
+    public void setUp() {
+        service = new TestPathService();
+        topoMgr = new FakeTopoMgr();
+        service.topologyService = topoMgr;
+        service.hostService = new HostServiceAdapter();
+    }
+
+    private void checkPathValues(Path path) {
+        assertThat(path, notNullValue());
+        assertThat(path.links(), hasSize(2));
+        assertThat(path.links().get(0).src(), is(cpA));
+        assertThat(path.links().get(0).dst(), is(cpB));
+        assertThat(path.links().get(1).src(), is(cpB));
+        assertThat(path.links().get(1).dst(), is(cpC));
+    }
+
+    private void checkDisjointPaths(Set<DisjointPath> paths) {
+        assertThat(paths, notNullValue());
+        assertThat(paths, hasSize(1));
+        Path path = paths.iterator().next();
+        checkPathValues(path);
+    }
+
+    private void checkPaths(Collection<Path> paths) {
+        assertThat(paths, notNullValue());
+        assertThat(paths, hasSize(1));
+        Path path = paths.iterator().next();
+        checkPathValues(path);
+    }
+
+    /**
+     * Tests no paths being set up.
+     */
+    @Test
+    public void testNoPaths() {
+        Set<Path> noPaths = service.getPaths(did("A"), did("B"), new TestWeigher());
+        assertThat(noPaths, empty());
+    }
+
+    /**
+     * Tests paths from a host.
+     */
+    @Test
+    public void testSelfPaths() {
+        HostId host = hid("12:34:56:78:90:ab/1");
+        Set<Path> paths = service.getPaths(host, host, new TestWeigher());
+        assertThat(paths, hasSize(1));
+        Path path = paths.iterator().next();
+        assertThat(path, not(nullValue()));
+        assertThat(path.links(), hasSize(2));
+        Link link1 = path.links().get(0);
+        Link link2 = path.links().get(1);
+        assertThat(link1.src(), is(link2.dst()));
+        assertThat(link2.src(), is(link1.dst()));
+        assertThat(link1.src().hostId(), is(host));
+        assertThat(link2.dst().hostId(), is(host));
+    }
+
+    /**
+     * Tests paths from a device to a device.
+     */
+    @Test
+    public void testDevicePaths() {
+        topoMgr.definePaths(ImmutableSet.of(path1));
+        Set<Path> pathsAC = service.getPaths(did("A"), did("C"), new TestWeigher());
+        checkPaths(pathsAC);
+    }
+
+    /**
+     * Tests K Shortest Path computation.
+     */
+    @Test
+    public void testKShortestPath() {
+        topoMgr.definePaths(ImmutableSet.of(path1));
+        List<Path> paths = service.getKShortestPaths(did("A"), did("C"), new TestWeigher())
+                .collect(Collectors.toList());
+        checkPaths(paths);
+    }
+
+    /**
+     * Tests disjoint paths.
+     */
+    @Test
+    public void testDisjointPaths() {
+        topoMgr.definePaths(ImmutableSet.of(path1));
+        Set<DisjointPath> paths = service.getDisjointPaths(did("A"), did("C"), new TestWeigher());
+        checkDisjointPaths(paths);
+    }
+
+    /**
+     * Tests disjoint paths with a risk profile.
+     */
+    @Test
+    public void testDisjointPathsWithRiskProfile() {
+        topoMgr.definePaths(ImmutableSet.of(path1));
+        Map<Link, Object> riskProfile = ImmutableMap.of();
+
+        Set<DisjointPath> paths =
+                service.getDisjointPaths(did("A"), did("C"), new TestWeigher(),
+                                         riskProfile);
+
+        checkDisjointPaths(paths);
+    }
+}
diff --git a/lib/BUCK b/lib/BUCK
index b4eed7b..8b6dc1d 100644
--- a/lib/BUCK
+++ b/lib/BUCK
@@ -1,4 +1,4 @@
-# ***** This file was auto-generated at Wed, 13 Sep 2017 22:16:27 GMT. Do not edit this file manually. *****
+# ***** This file was auto-generated at Fri, 22 Sep 2017 06:46:04 GMT. Do not edit this file manually. *****
 # ***** Use onos-lib-gen *****
 
 pass_thru_pom(
@@ -50,6 +50,7 @@
     ':junit',
     ':easymock',
     ':hamcrest-all',
+    ':hamcrest-optional',
     ':guava-testlib',
     '//utils/junit:onlab-junit',
   ],
@@ -1509,3 +1510,12 @@
   visibility = [ 'PUBLIC' ],
 )
 
+remote_jar (
+  name = 'hamcrest-optional',
+  out = 'hamcrest-optional-1.1.0.jar',
+  url = 'mvn:com.spotify:hamcrest-optional:jar:1.1.0',
+  sha1 = 'c2dfe3a43794b15fb4c28de0027fe6e249855b3b',
+  maven_coords = 'com.spotify:hamcrest-optional:jar:NON-OSGI:1.1.0',
+  visibility = [ 'PUBLIC' ],
+)
+
diff --git a/lib/deps.json b/lib/deps.json
index 5a9124c..071d95f 100644
--- a/lib/deps.json
+++ b/lib/deps.json
@@ -29,6 +29,7 @@
       "junit",
       "easymock",
       "hamcrest-all",
+      "hamcrest-optional",
       "guava-testlib",
       "//utils/junit:onlab-junit"
     ],
@@ -268,6 +269,7 @@
     "google-errorprone-2.0.19": "mvn:com.google.errorprone:error_prone_annotations:2.0.19",
     "google-instrumentation-0.3.0": "mvn:com.google.instrumentation:instrumentation-api:0.3.0",
     "bcpkix-jdk15on": "mvn:org.bouncycastle:bcpkix-jdk15on:1.58",
-    "bcprov-jdk15on": "mvn:org.bouncycastle:bcprov-jdk15on:1.58"
+    "bcprov-jdk15on": "mvn:org.bouncycastle:bcprov-jdk15on:1.58",
+    "hamcrest-optional": "mvn:com.spotify:hamcrest-optional:1.1.0"
   }
 }
diff --git a/lib/pom.xml b/lib/pom.xml
index 07ef09b..bae6e67 100644
--- a/lib/pom.xml
+++ b/lib/pom.xml
@@ -77,6 +77,12 @@
                 <version>1.3</version>
                 <scope>test</scope>
             </dependency>
+            <dependency>
+                <groupId>com.spotify</groupId>
+                <artifactId>hamcrest-optional</artifactId>
+                <version>1.1.0</version>
+                <scope>test</scope>
+            </dependency>
 
             <dependency>
                 <groupId>org.slf4j</groupId>
@@ -650,6 +656,12 @@
         </dependency>
 
         <dependency>
+            <groupId>com.spotify</groupId>
+            <artifactId>hamcrest-optional</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
             <groupId>com.google.guava</groupId>
             <artifactId>guava-testlib</artifactId>
             <scope>test</scope>