Entry
org.scalatest.Entry
case class Entry[K, V](key: K, value: V) extends Entry[K, V]
A case class implementation of java.util.Map.Entry to make it easier to test Java Maps with ScalaTest Matchers.
In Java, java.util.Map is not a subtype of java.util.Collection, and does not actually define an element type. You can ask a Java Map for an “entry set” via the entrySet method, which will return the Map's key/value pairs wrapped in a set of java.util.Map.Entry, but a Map is not actually a collection of Entry. To make Java Maps easier to work with, however, ScalaTest matchers allows you to treat a Java Map as a collection of Entry, and defines this convenience implementation of java.util.Map.Entry. Here's how you use it:
javaMap should contain (Entry(2, 3)) javaMap should contain oneOf (Entry(2, 3), Entry(3, 4))
Value parameters
- key
-
the key of this entry
- value
-
the value of this entry
Attributes
- Graph
-
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Entry[K, V]class Objecttrait Matchableclass Any
Members list
In this article