svn commit: r1857960 - /ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/collections/MultivaluedMapContextTests.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1857960 - /ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/collections/MultivaluedMapContextTests.java

mthl
Author: mthl
Date: Mon Apr 22 13:47:36 2019
New Revision: 1857960

URL: http://svn.apache.org/viewvc?rev=1857960&view=rev
Log:
Improved: Use ‘contains’ matcher when possible
(OFBIZ-10941)

It is more precise to use the ‘contains’ matcher when checking the
values, completeness and order of a collection.

Modified:
    ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/collections/MultivaluedMapContextTests.java

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/collections/MultivaluedMapContextTests.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/collections/MultivaluedMapContextTests.java?rev=1857960&r1=1857959&r2=1857960&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/collections/MultivaluedMapContextTests.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/collections/MultivaluedMapContextTests.java Mon Apr 22 13:47:36 2019
@@ -18,11 +18,8 @@
  *******************************************************************************/
 package org.apache.ofbiz.base.collections;
 
-import static org.hamcrest.CoreMatchers.both;
-import static org.hamcrest.CoreMatchers.hasItem;
-import static org.hamcrest.CoreMatchers.hasItems;
+import static org.hamcrest.Matchers.contains;
 import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
 import static org.hamcrest.CoreMatchers.nullValue;
 import static org.junit.Assert.assertThat;
 
@@ -46,26 +43,26 @@ public class MultivaluedMapContextTests
     @Test
     public void putSingleBasic() {
         m.putSingle("foo", 0);
-        assertThat(m.get("foo"), hasItem(0));
+        assertThat(m.get("foo"), contains(0));
         m.putSingle("foo", 1);
-        assertThat(m.get("foo"), both(hasItem(1)).and(not(hasItem(0))));
+        assertThat(m.get("foo"), contains(1));
     }
 
     @Test
     public void addBasic() {
         m.add("foo", 0);
-        assertThat(m.get("foo"), hasItem(0));
+        assertThat(m.get("foo"), contains(0));
         m.add("foo", 1);
-        assertThat(m.get("foo"), hasItems(0, 1));
+        assertThat(m.get("foo"), contains(0, 1));
     }
 
     @Test
     public void addWithPreviousContext() {
         m.add("foo", 0);
         m.push();
-        assertThat(m.get("foo"), hasItem(0));
+        assertThat(m.get("foo"), contains(0));
         m.add("foo", 1);
-        assertThat(m.get("foo"), hasItems(0, 1));
+        assertThat(m.get("foo"), contains(0, 1));
     }
 
     @Test