Re: commons-collections git commit: MapUtilsTest: fix order of expected and actual parameter in assertions (closes #32)

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: commons-collections git commit: MapUtilsTest: fix order of expected and actual parameter in assertions (closes #32)

garydgregory
Thank you for doing that! That was driving me nuts!

Gary

On Oct 14, 2017 10:53, <[hidden email]> wrote:

> Repository: commons-collections
> Updated Branches:
>   refs/heads/master 641aa1c66 -> b9522976f
>
>
> MapUtilsTest: fix order of expected and actual parameter in assertions
> (closes #32)
>
>
> Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
> Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/
> commit/b9522976
> Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/
> tree/b9522976
> Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/
> diff/b9522976
>
> Branch: refs/heads/master
> Commit: b9522976f462687b0693b7229ba5c7faee0cb74b
> Parents: 641aa1c
> Author: Kavuri, Vamsi <[hidden email]>
> Authored: Sat Oct 14 12:30:35 2017 -0400
> Committer: pascalschumacher <[hidden email]>
> Committed: Sat Oct 14 18:52:04 2017 +0200
>
> ----------------------------------------------------------------------
>  .../commons/collections4/MapUtilsTest.java      | 110 +++++++++----------
>  1 file changed, 55 insertions(+), 55 deletions(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/commons-collections/
> blob/b9522976/src/test/java/org/apache/commons/
> collections4/MapUtilsTest.java
> ----------------------------------------------------------------------
> diff --git a/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
> b/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
> index fc3e3d6..21f20c4 100644
> --- a/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
> +++ b/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
> @@ -950,12 +950,12 @@ public class MapUtilsTest extends
> AbstractAvailableLocalesTest {
>          final Map<String, Double> in = new HashMap<>();
>          in.put("key", 2.0);
>
> -        assertEquals(MapUtils.getDoubleValue(in,"key", 0.0), 2.0, 0);
> -        assertEquals(MapUtils.getDoubleValue(in,"key"), 2.0, 0);
> -        assertEquals(MapUtils.getDoubleValue(in,"noKey", 1.0), 1.0, 0);
> -        assertEquals(MapUtils.getDoubleValue(in,"noKey"), 0, 0);
> -        assertEquals(MapUtils.getDouble(in,"key", 0.0), 2.0, 0);
> -        assertEquals(MapUtils.getDouble(in,"noKey", 1.0), 1.0, 0);
> +        assertEquals(2.0, MapUtils.getDoubleValue(in,"key", 0.0), 0);
> +        assertEquals(2.0, MapUtils.getDoubleValue(in,"key"), 0);
> +        assertEquals(1.0, MapUtils.getDoubleValue(in,"noKey", 1.0), 0);
> +        assertEquals(0, MapUtils.getDoubleValue(in,"noKey"), 0);
> +        assertEquals(2.0, MapUtils.getDouble(in,"key", 0.0), 0);
> +        assertEquals(1.0, MapUtils.getDouble(in,"noKey", 1.0), 0);
>
>
>          final Map<String, String> inStr = new HashMap<>();
> @@ -970,12 +970,12 @@ public class MapUtilsTest extends
> AbstractAvailableLocalesTest {
>          final Map<String, Float> in = new HashMap<>();
>          in.put("key", 2.0f);
>
> -        assertEquals(MapUtils.getFloatValue(in,"key", 0.0f), 2.0, 0);
> -        assertEquals(MapUtils.getFloatValue(in,"key"), 2.0, 0);
> -        assertEquals(MapUtils.getFloatValue(in,"noKey", 1.0f), 1.0, 0);
> -        assertEquals(MapUtils.getFloatValue(in,"noKey"), 0, 0);
> -        assertEquals(MapUtils.getFloat(in,"key", 0.0f), 2.0, 0);
> -        assertEquals(MapUtils.getFloat(in,"noKey", 1.0f), 1.0, 0);
> +        assertEquals(2.0, MapUtils.getFloatValue(in,"key", 0.0f), 0);
> +        assertEquals(2.0, MapUtils.getFloatValue(in,"key"), 0);
> +        assertEquals(1.0, MapUtils.getFloatValue(in,"noKey", 1.0f), 0);
> +        assertEquals(0, MapUtils.getFloatValue(in,"noKey"), 0);
> +        assertEquals(2.0, MapUtils.getFloat(in,"key", 0.0f), 0);
> +        assertEquals(1.0, MapUtils.getFloat(in,"noKey", 1.0f), 0);
>
>          final Map<String, String> inStr = new HashMap<>();
>          char decimalSeparator = getDecimalSeparator();
> @@ -989,12 +989,12 @@ public class MapUtilsTest extends
> AbstractAvailableLocalesTest {
>          final Map<String, Long> in = new HashMap<>();
>          in.put("key", 2L);
>
> -        assertEquals(MapUtils.getLongValue(in,"key", 0L), 2.0, 0);
> -        assertEquals(MapUtils.getLongValue(in,"key"), 2.0, 0);
> -        assertEquals(MapUtils.getLongValue(in,"noKey", 1L), 1, 0);
> -        assertEquals(MapUtils.getLongValue(in,"noKey"), 0, 0);
> -        assertEquals(MapUtils.getLong(in,"key", 0L), 2.0, 0);
> -        assertEquals(MapUtils.getLong(in,"noKey", 1L), 1, 0);
> +        assertEquals(2.0, MapUtils.getLongValue(in,"key", 0L), 0);
> +        assertEquals(2.0, MapUtils.getLongValue(in,"key"), 0);
> +        assertEquals(1, MapUtils.getLongValue(in,"noKey", 1L), 0);
> +        assertEquals(0, MapUtils.getLongValue(in,"noKey"), 0);
> +        assertEquals(2.0, MapUtils.getLong(in,"key", 0L), 0);
> +        assertEquals(1, MapUtils.getLong(in,"noKey", 1L), 0);
>
>          final Map<String, String> inStr = new HashMap<>();
>          inStr.put("str1", "2");
> @@ -1009,12 +1009,12 @@ public class MapUtilsTest extends
> AbstractAvailableLocalesTest {
>          final Map<String, Integer> in = new HashMap<>();
>          in.put("key", 2);
>
> -        assertEquals(MapUtils.getIntValue(in,"key", 0), 2, 0);
> -        assertEquals(MapUtils.getIntValue(in,"key"), 2, 0);
> -        assertEquals(MapUtils.getIntValue(in,"noKey", 0), 0, 0);
> -        assertEquals(MapUtils.getIntValue(in,"noKey"), 0, 0);
> -        assertEquals(MapUtils.getInteger(in,"key", 0), 2, 0);
> -        assertEquals(MapUtils.getInteger(in,"noKey", 0), 0, 0);
> +        assertEquals(2, MapUtils.getIntValue(in,"key", 0), 0);
> +        assertEquals(2, MapUtils.getIntValue(in,"key"), 0);
> +        assertEquals(0, MapUtils.getIntValue(in,"noKey", 0), 0);
> +        assertEquals(0, MapUtils.getIntValue(in,"noKey"), 0);
> +        assertEquals(2, MapUtils.getInteger(in,"key", 0), 0);
> +        assertEquals(0, MapUtils.getInteger(in,"noKey", 0), 0);
>
>          final Map<String, String> inStr = new HashMap<>();
>          inStr.put("str1", "2");
> @@ -1028,12 +1028,12 @@ public class MapUtilsTest extends
> AbstractAvailableLocalesTest {
>          final short val = 10;
>          in.put("key", val);
>
> -        assertEquals(MapUtils.getShortValue(in,"key", val), val, 0);
> -        assertEquals(MapUtils.getShortValue(in,"key"), val, 0);
> -        assertEquals(MapUtils.getShortValue(in,"noKey", val), val, 0);
> -        assertEquals(MapUtils.getShortValue(in,"noKey"), 0, 0);
> -        assertEquals(MapUtils.getShort(in,"key", val), val, 0);
> -        assertEquals(MapUtils.getShort(in,"noKey", val), val, 0);
> +        assertEquals(val, MapUtils.getShortValue(in,"key", val), 0);
> +        assertEquals(val, MapUtils.getShortValue(in,"key"), 0);
> +        assertEquals(val, MapUtils.getShortValue(in,"noKey", val), 0);
> +        assertEquals(0, MapUtils.getShortValue(in,"noKey"), 0);
> +        assertEquals(val, MapUtils.getShort(in,"key", val), 0);
> +        assertEquals(val,MapUtils.getShort(in,"noKey", val), 0);
>
>          final Map<String, String> inStr = new HashMap<>();
>          inStr.put("str1", "10");
> @@ -1047,12 +1047,12 @@ public class MapUtilsTest extends
> AbstractAvailableLocalesTest {
>          final byte val = 100;
>          in.put("key", val);
>
> -        assertEquals(MapUtils.getByteValue(in,"key", val), val, 0);
> -        assertEquals(MapUtils.getByteValue(in,"key"), val, 0);
> -        assertEquals(MapUtils.getByteValue(in,"noKey", val), val, 0);
> -        assertEquals(MapUtils.getByteValue(in,"noKey"), 0, 0);
> -        assertEquals(MapUtils.getByte(in,"key", val), val, 0);
> -        assertEquals(MapUtils.getByte(in,"noKey", val), val, 0);
> +        assertEquals(val, MapUtils.getByteValue(in,"key", val), 0);
> +        assertEquals(val, MapUtils.getByteValue(in,"key"), 0);
> +        assertEquals(val, MapUtils.getByteValue(in,"noKey", val), 0);
> +        assertEquals(0, MapUtils.getByteValue(in,"noKey"), 0);
> +        assertEquals(val, MapUtils.getByte(in,"key", val), 0);
> +        assertEquals(val, MapUtils.getByte(in,"noKey", val), 0);
>
>
>          final Map<String, String> inStr = new HashMap<>();
> @@ -1067,8 +1067,8 @@ public class MapUtilsTest extends
> AbstractAvailableLocalesTest {
>          final Number val = 1000;
>          in.put("key", val);
>
> -        assertEquals(MapUtils.getNumber(in,"key", val).intValue(),
> val.intValue(), 0);
> -        assertEquals(MapUtils.getNumber(in,"noKey", val).intValue(),
> val.intValue(), 0);
> +        assertEquals(val.intValue(), MapUtils.getNumber(in,"key",
> val).intValue(), 0);
> +        assertEquals(val.intValue(), MapUtils.getNumber(in,"noKey",
> val).intValue(), 0);
>
>      }
>
> @@ -1077,11 +1077,11 @@ public class MapUtilsTest extends
> AbstractAvailableLocalesTest {
>          final Map<String, String> in = new HashMap<>();
>          in.put("key", "str");
>
> -        assertEquals(MapUtils.getString(in,"key", "defualt"), "str");
> -        assertEquals(MapUtils.getString(in,"key"), "str");
> -        assertEquals(MapUtils.getString(null,"key"), null);
> -        assertEquals(MapUtils.getString(in,"noKey", "default"),
> "default");
> -        assertEquals(MapUtils.getString(null,"noKey", "default"),
> "default");
> +        assertEquals("str", MapUtils.getString(in,"key", "defualt"));
> +        assertEquals("str", MapUtils.getString(in,"key"));
> +        assertEquals(null, MapUtils.getString(null,"key"));
> +        assertEquals("default", MapUtils.getString(in,"noKey",
> "default"));
> +        assertEquals("default", MapUtils.getString(null,"noKey",
> "default"));
>
>      }
>
> @@ -1090,11 +1090,11 @@ public class MapUtilsTest extends
> AbstractAvailableLocalesTest {
>          final Map<String, Object> in = new HashMap<>();
>          in.put("key", "str");
>
> -        assertEquals(MapUtils.getObject(in,"key", "defualt"), "str");
> -        assertEquals(MapUtils.getObject(in,"key"), "str");
> -        assertEquals(MapUtils.getObject(null,"key"), null);
> -        assertEquals(MapUtils.getObject(in,"noKey", "default"),
> "default");
> -        assertEquals(MapUtils.getObject(null,"noKey", "default"),
> "default");
> +        assertEquals("str", MapUtils.getObject(in,"key", "defualt"));
> +        assertEquals("str", MapUtils.getObject(in,"key"));
> +        assertEquals(null, MapUtils.getObject(null,"key"));
> +        assertEquals("default", MapUtils.getObject(in,"noKey",
> "default"));
> +        assertEquals("default", MapUtils.getObject(null,"noKey",
> "default"));
>
>      }
>
> @@ -1109,7 +1109,7 @@ public class MapUtilsTest extends
> AbstractAvailableLocalesTest {
>          assertTrue(!MapUtils.getBooleanValue(in,"noKey"));
>          assertTrue(MapUtils.getBoolean(in,"key", true));
>          assertTrue(MapUtils.getBoolean(in,"noKey", true));
> -        assertEquals(MapUtils.getBoolean(null,"noKey"),null);
> +        assertEquals(null, MapUtils.getBoolean(null,"noKey"));
>
>
>
> @@ -1130,10 +1130,10 @@ public class MapUtilsTest extends
> AbstractAvailableLocalesTest {
>          in.put("key1", valMap);
>          final Map<?, ?> outValue =  MapUtils.getMap(in,"key1", null);
>
> -        assertEquals( outValue.get("key1"), "value1");
> -        assertEquals( outValue.get("key2"), null);
> -        assertEquals( MapUtils.getMap(in,"key2", null), null);
> -        assertEquals( MapUtils.getMap(null,"key2", null), null);
> +        assertEquals("value1", outValue.get("key1"));
> +        assertEquals(null, outValue.get("key2"));
> +        assertEquals(null, MapUtils.getMap(in,"key2", null));
> +        assertEquals(null, MapUtils.getMap(null,"key2", null));
>      }
>
>      @Test
> @@ -1143,8 +1143,8 @@ public class MapUtilsTest extends
> AbstractAvailableLocalesTest {
>
>          MapUtils.safeAddToMap(inMap,"key1", "value1");
>          MapUtils.safeAddToMap(inMap,"key2", null);
> -        assertEquals( inMap.get("key1"), "value1");
> -        assertEquals( inMap.get("key2"), "");
> +        assertEquals("value1", inMap.get("key1"));
> +        assertEquals("", inMap.get("key2"));
>      }
>
>      @Test
>
>
Reply | Threaded
Open this post in threaded view
|

Re: commons-collections git commit: MapUtilsTest: fix order of expected and actual parameter in assertions (closes #32)

Benedikt Ritter-4
About time we migrate to AssertJ. :-)

Gary Gregory <[hidden email]> schrieb am Sa. 14. Okt. 2017 um 18:55:

> Thank you for doing that! That was driving me nuts!
>
> Gary
>
> On Oct 14, 2017 10:53, <[hidden email]> wrote:
>
> > Repository: commons-collections
> > Updated Branches:
> >   refs/heads/master 641aa1c66 -> b9522976f
> >
> >
> > MapUtilsTest: fix order of expected and actual parameter in assertions
> > (closes #32)
> >
> >
> > Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
> > Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/
> > commit/b9522976
> > Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/
> > tree/b9522976
> > Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/
> > diff/b9522976
> >
> > Branch: refs/heads/master
> > Commit: b9522976f462687b0693b7229ba5c7faee0cb74b
> > Parents: 641aa1c
> > Author: Kavuri, Vamsi <[hidden email]>
> > Authored: Sat Oct 14 12:30:35 2017 -0400
> > Committer: pascalschumacher <[hidden email]>
> > Committed: Sat Oct 14 18:52:04 2017 +0200
> >
> > ----------------------------------------------------------------------
> >  .../commons/collections4/MapUtilsTest.java      | 110
> +++++++++----------
> >  1 file changed, 55 insertions(+), 55 deletions(-)
> > ----------------------------------------------------------------------
> >
> >
> > http://git-wip-us.apache.org/repos/asf/commons-collections/
> > blob/b9522976/src/test/java/org/apache/commons/
> > collections4/MapUtilsTest.java
> > ----------------------------------------------------------------------
> > diff --git
> a/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
> > b/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
> > index fc3e3d6..21f20c4 100644
> > --- a/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
> > +++ b/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
> > @@ -950,12 +950,12 @@ public class MapUtilsTest extends
> > AbstractAvailableLocalesTest {
> >          final Map<String, Double> in = new HashMap<>();
> >          in.put("key", 2.0);
> >
> > -        assertEquals(MapUtils.getDoubleValue(in,"key", 0.0), 2.0, 0);
> > -        assertEquals(MapUtils.getDoubleValue(in,"key"), 2.0, 0);
> > -        assertEquals(MapUtils.getDoubleValue(in,"noKey", 1.0), 1.0, 0);
> > -        assertEquals(MapUtils.getDoubleValue(in,"noKey"), 0, 0);
> > -        assertEquals(MapUtils.getDouble(in,"key", 0.0), 2.0, 0);
> > -        assertEquals(MapUtils.getDouble(in,"noKey", 1.0), 1.0, 0);
> > +        assertEquals(2.0, MapUtils.getDoubleValue(in,"key", 0.0), 0);
> > +        assertEquals(2.0, MapUtils.getDoubleValue(in,"key"), 0);
> > +        assertEquals(1.0, MapUtils.getDoubleValue(in,"noKey", 1.0), 0);
> > +        assertEquals(0, MapUtils.getDoubleValue(in,"noKey"), 0);
> > +        assertEquals(2.0, MapUtils.getDouble(in,"key", 0.0), 0);
> > +        assertEquals(1.0, MapUtils.getDouble(in,"noKey", 1.0), 0);
> >
> >
> >          final Map<String, String> inStr = new HashMap<>();
> > @@ -970,12 +970,12 @@ public class MapUtilsTest extends
> > AbstractAvailableLocalesTest {
> >          final Map<String, Float> in = new HashMap<>();
> >          in.put("key", 2.0f);
> >
> > -        assertEquals(MapUtils.getFloatValue(in,"key", 0.0f), 2.0, 0);
> > -        assertEquals(MapUtils.getFloatValue(in,"key"), 2.0, 0);
> > -        assertEquals(MapUtils.getFloatValue(in,"noKey", 1.0f), 1.0, 0);
> > -        assertEquals(MapUtils.getFloatValue(in,"noKey"), 0, 0);
> > -        assertEquals(MapUtils.getFloat(in,"key", 0.0f), 2.0, 0);
> > -        assertEquals(MapUtils.getFloat(in,"noKey", 1.0f), 1.0, 0);
> > +        assertEquals(2.0, MapUtils.getFloatValue(in,"key", 0.0f), 0);
> > +        assertEquals(2.0, MapUtils.getFloatValue(in,"key"), 0);
> > +        assertEquals(1.0, MapUtils.getFloatValue(in,"noKey", 1.0f), 0);
> > +        assertEquals(0, MapUtils.getFloatValue(in,"noKey"), 0);
> > +        assertEquals(2.0, MapUtils.getFloat(in,"key", 0.0f), 0);
> > +        assertEquals(1.0, MapUtils.getFloat(in,"noKey", 1.0f), 0);
> >
> >          final Map<String, String> inStr = new HashMap<>();
> >          char decimalSeparator = getDecimalSeparator();
> > @@ -989,12 +989,12 @@ public class MapUtilsTest extends
> > AbstractAvailableLocalesTest {
> >          final Map<String, Long> in = new HashMap<>();
> >          in.put("key", 2L);
> >
> > -        assertEquals(MapUtils.getLongValue(in,"key", 0L), 2.0, 0);
> > -        assertEquals(MapUtils.getLongValue(in,"key"), 2.0, 0);
> > -        assertEquals(MapUtils.getLongValue(in,"noKey", 1L), 1, 0);
> > -        assertEquals(MapUtils.getLongValue(in,"noKey"), 0, 0);
> > -        assertEquals(MapUtils.getLong(in,"key", 0L), 2.0, 0);
> > -        assertEquals(MapUtils.getLong(in,"noKey", 1L), 1, 0);
> > +        assertEquals(2.0, MapUtils.getLongValue(in,"key", 0L), 0);
> > +        assertEquals(2.0, MapUtils.getLongValue(in,"key"), 0);
> > +        assertEquals(1, MapUtils.getLongValue(in,"noKey", 1L), 0);
> > +        assertEquals(0, MapUtils.getLongValue(in,"noKey"), 0);
> > +        assertEquals(2.0, MapUtils.getLong(in,"key", 0L), 0);
> > +        assertEquals(1, MapUtils.getLong(in,"noKey", 1L), 0);
> >
> >          final Map<String, String> inStr = new HashMap<>();
> >          inStr.put("str1", "2");
> > @@ -1009,12 +1009,12 @@ public class MapUtilsTest extends
> > AbstractAvailableLocalesTest {
> >          final Map<String, Integer> in = new HashMap<>();
> >          in.put("key", 2);
> >
> > -        assertEquals(MapUtils.getIntValue(in,"key", 0), 2, 0);
> > -        assertEquals(MapUtils.getIntValue(in,"key"), 2, 0);
> > -        assertEquals(MapUtils.getIntValue(in,"noKey", 0), 0, 0);
> > -        assertEquals(MapUtils.getIntValue(in,"noKey"), 0, 0);
> > -        assertEquals(MapUtils.getInteger(in,"key", 0), 2, 0);
> > -        assertEquals(MapUtils.getInteger(in,"noKey", 0), 0, 0);
> > +        assertEquals(2, MapUtils.getIntValue(in,"key", 0), 0);
> > +        assertEquals(2, MapUtils.getIntValue(in,"key"), 0);
> > +        assertEquals(0, MapUtils.getIntValue(in,"noKey", 0), 0);
> > +        assertEquals(0, MapUtils.getIntValue(in,"noKey"), 0);
> > +        assertEquals(2, MapUtils.getInteger(in,"key", 0), 0);
> > +        assertEquals(0, MapUtils.getInteger(in,"noKey", 0), 0);
> >
> >          final Map<String, String> inStr = new HashMap<>();
> >          inStr.put("str1", "2");
> > @@ -1028,12 +1028,12 @@ public class MapUtilsTest extends
> > AbstractAvailableLocalesTest {
> >          final short val = 10;
> >          in.put("key", val);
> >
> > -        assertEquals(MapUtils.getShortValue(in,"key", val), val, 0);
> > -        assertEquals(MapUtils.getShortValue(in,"key"), val, 0);
> > -        assertEquals(MapUtils.getShortValue(in,"noKey", val), val, 0);
> > -        assertEquals(MapUtils.getShortValue(in,"noKey"), 0, 0);
> > -        assertEquals(MapUtils.getShort(in,"key", val), val, 0);
> > -        assertEquals(MapUtils.getShort(in,"noKey", val), val, 0);
> > +        assertEquals(val, MapUtils.getShortValue(in,"key", val), 0);
> > +        assertEquals(val, MapUtils.getShortValue(in,"key"), 0);
> > +        assertEquals(val, MapUtils.getShortValue(in,"noKey", val), 0);
> > +        assertEquals(0, MapUtils.getShortValue(in,"noKey"), 0);
> > +        assertEquals(val, MapUtils.getShort(in,"key", val), 0);
> > +        assertEquals(val,MapUtils.getShort(in,"noKey", val), 0);
> >
> >          final Map<String, String> inStr = new HashMap<>();
> >          inStr.put("str1", "10");
> > @@ -1047,12 +1047,12 @@ public class MapUtilsTest extends
> > AbstractAvailableLocalesTest {
> >          final byte val = 100;
> >          in.put("key", val);
> >
> > -        assertEquals(MapUtils.getByteValue(in,"key", val), val, 0);
> > -        assertEquals(MapUtils.getByteValue(in,"key"), val, 0);
> > -        assertEquals(MapUtils.getByteValue(in,"noKey", val), val, 0);
> > -        assertEquals(MapUtils.getByteValue(in,"noKey"), 0, 0);
> > -        assertEquals(MapUtils.getByte(in,"key", val), val, 0);
> > -        assertEquals(MapUtils.getByte(in,"noKey", val), val, 0);
> > +        assertEquals(val, MapUtils.getByteValue(in,"key", val), 0);
> > +        assertEquals(val, MapUtils.getByteValue(in,"key"), 0);
> > +        assertEquals(val, MapUtils.getByteValue(in,"noKey", val), 0);
> > +        assertEquals(0, MapUtils.getByteValue(in,"noKey"), 0);
> > +        assertEquals(val, MapUtils.getByte(in,"key", val), 0);
> > +        assertEquals(val, MapUtils.getByte(in,"noKey", val), 0);
> >
> >
> >          final Map<String, String> inStr = new HashMap<>();
> > @@ -1067,8 +1067,8 @@ public class MapUtilsTest extends
> > AbstractAvailableLocalesTest {
> >          final Number val = 1000;
> >          in.put("key", val);
> >
> > -        assertEquals(MapUtils.getNumber(in,"key", val).intValue(),
> > val.intValue(), 0);
> > -        assertEquals(MapUtils.getNumber(in,"noKey", val).intValue(),
> > val.intValue(), 0);
> > +        assertEquals(val.intValue(), MapUtils.getNumber(in,"key",
> > val).intValue(), 0);
> > +        assertEquals(val.intValue(), MapUtils.getNumber(in,"noKey",
> > val).intValue(), 0);
> >
> >      }
> >
> > @@ -1077,11 +1077,11 @@ public class MapUtilsTest extends
> > AbstractAvailableLocalesTest {
> >          final Map<String, String> in = new HashMap<>();
> >          in.put("key", "str");
> >
> > -        assertEquals(MapUtils.getString(in,"key", "defualt"), "str");
> > -        assertEquals(MapUtils.getString(in,"key"), "str");
> > -        assertEquals(MapUtils.getString(null,"key"), null);
> > -        assertEquals(MapUtils.getString(in,"noKey", "default"),
> > "default");
> > -        assertEquals(MapUtils.getString(null,"noKey", "default"),
> > "default");
> > +        assertEquals("str", MapUtils.getString(in,"key", "defualt"));
> > +        assertEquals("str", MapUtils.getString(in,"key"));
> > +        assertEquals(null, MapUtils.getString(null,"key"));
> > +        assertEquals("default", MapUtils.getString(in,"noKey",
> > "default"));
> > +        assertEquals("default", MapUtils.getString(null,"noKey",
> > "default"));
> >
> >      }
> >
> > @@ -1090,11 +1090,11 @@ public class MapUtilsTest extends
> > AbstractAvailableLocalesTest {
> >          final Map<String, Object> in = new HashMap<>();
> >          in.put("key", "str");
> >
> > -        assertEquals(MapUtils.getObject(in,"key", "defualt"), "str");
> > -        assertEquals(MapUtils.getObject(in,"key"), "str");
> > -        assertEquals(MapUtils.getObject(null,"key"), null);
> > -        assertEquals(MapUtils.getObject(in,"noKey", "default"),
> > "default");
> > -        assertEquals(MapUtils.getObject(null,"noKey", "default"),
> > "default");
> > +        assertEquals("str", MapUtils.getObject(in,"key", "defualt"));
> > +        assertEquals("str", MapUtils.getObject(in,"key"));
> > +        assertEquals(null, MapUtils.getObject(null,"key"));
> > +        assertEquals("default", MapUtils.getObject(in,"noKey",
> > "default"));
> > +        assertEquals("default", MapUtils.getObject(null,"noKey",
> > "default"));
> >
> >      }
> >
> > @@ -1109,7 +1109,7 @@ public class MapUtilsTest extends
> > AbstractAvailableLocalesTest {
> >          assertTrue(!MapUtils.getBooleanValue(in,"noKey"));
> >          assertTrue(MapUtils.getBoolean(in,"key", true));
> >          assertTrue(MapUtils.getBoolean(in,"noKey", true));
> > -        assertEquals(MapUtils.getBoolean(null,"noKey"),null);
> > +        assertEquals(null, MapUtils.getBoolean(null,"noKey"));
> >
> >
> >
> > @@ -1130,10 +1130,10 @@ public class MapUtilsTest extends
> > AbstractAvailableLocalesTest {
> >          in.put("key1", valMap);
> >          final Map<?, ?> outValue =  MapUtils.getMap(in,"key1", null);
> >
> > -        assertEquals( outValue.get("key1"), "value1");
> > -        assertEquals( outValue.get("key2"), null);
> > -        assertEquals( MapUtils.getMap(in,"key2", null), null);
> > -        assertEquals( MapUtils.getMap(null,"key2", null), null);
> > +        assertEquals("value1", outValue.get("key1"));
> > +        assertEquals(null, outValue.get("key2"));
> > +        assertEquals(null, MapUtils.getMap(in,"key2", null));
> > +        assertEquals(null, MapUtils.getMap(null,"key2", null));
> >      }
> >
> >      @Test
> > @@ -1143,8 +1143,8 @@ public class MapUtilsTest extends
> > AbstractAvailableLocalesTest {
> >
> >          MapUtils.safeAddToMap(inMap,"key1", "value1");
> >          MapUtils.safeAddToMap(inMap,"key2", null);
> > -        assertEquals( inMap.get("key1"), "value1");
> > -        assertEquals( inMap.get("key2"), "");
> > +        assertEquals("value1", inMap.get("key1"));
> > +        assertEquals("", inMap.get("key2"));
> >      }
> >
> >      @Test
> >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: commons-collections git commit: MapUtilsTest: fix order of expected and actual parameter in assertions (closes #32)

Pascal Schumacher
Any time. :-)

Migrating is not hard, as there are scripts to do most of the work, see:

https://joel-costigliola.github.io/assertj/assertj-core-converting-junit-assertions-to-assertj.html

Am 14.10.2017 um 19:06 schrieb Benedikt Ritter:

> About time we migrate to AssertJ. :-)
>
> Gary Gregory <[hidden email]> schrieb am Sa. 14. Okt. 2017 um 18:55:
>
>> Thank you for doing that! That was driving me nuts!
>>
>> Gary
>>
>> On Oct 14, 2017 10:53, <[hidden email]> wrote:
>>
>>> Repository: commons-collections
>>> Updated Branches:
>>>    refs/heads/master 641aa1c66 -> b9522976f
>>>
>>>
>>> MapUtilsTest: fix order of expected and actual parameter in assertions
>>> (closes #32)
>>>
>>>
>>> Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
>>> Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/
>>> commit/b9522976
>>> Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/
>>> tree/b9522976
>>> Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/
>>> diff/b9522976
>>>
>>> Branch: refs/heads/master
>>> Commit: b9522976f462687b0693b7229ba5c7faee0cb74b
>>> Parents: 641aa1c
>>> Author: Kavuri, Vamsi <[hidden email]>
>>> Authored: Sat Oct 14 12:30:35 2017 -0400
>>> Committer: pascalschumacher <[hidden email]>
>>> Committed: Sat Oct 14 18:52:04 2017 +0200
>>>
>>> ----------------------------------------------------------------------
>>>   .../commons/collections4/MapUtilsTest.java      | 110
>> +++++++++----------
>>>   1 file changed, 55 insertions(+), 55 deletions(-)
>>> ----------------------------------------------------------------------
>>>
>>>
>>> http://git-wip-us.apache.org/repos/asf/commons-collections/
>>> blob/b9522976/src/test/java/org/apache/commons/
>>> collections4/MapUtilsTest.java
>>> ----------------------------------------------------------------------
>>> diff --git
>> a/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
>>> b/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
>>> index fc3e3d6..21f20c4 100644
>>> --- a/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
>>> +++ b/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
>>> @@ -950,12 +950,12 @@ public class MapUtilsTest extends
>>> AbstractAvailableLocalesTest {
>>>           final Map<String, Double> in = new HashMap<>();
>>>           in.put("key", 2.0);
>>>
>>> -        assertEquals(MapUtils.getDoubleValue(in,"key", 0.0), 2.0, 0);
>>> -        assertEquals(MapUtils.getDoubleValue(in,"key"), 2.0, 0);
>>> -        assertEquals(MapUtils.getDoubleValue(in,"noKey", 1.0), 1.0, 0);
>>> -        assertEquals(MapUtils.getDoubleValue(in,"noKey"), 0, 0);
>>> -        assertEquals(MapUtils.getDouble(in,"key", 0.0), 2.0, 0);
>>> -        assertEquals(MapUtils.getDouble(in,"noKey", 1.0), 1.0, 0);
>>> +        assertEquals(2.0, MapUtils.getDoubleValue(in,"key", 0.0), 0);
>>> +        assertEquals(2.0, MapUtils.getDoubleValue(in,"key"), 0);
>>> +        assertEquals(1.0, MapUtils.getDoubleValue(in,"noKey", 1.0), 0);
>>> +        assertEquals(0, MapUtils.getDoubleValue(in,"noKey"), 0);
>>> +        assertEquals(2.0, MapUtils.getDouble(in,"key", 0.0), 0);
>>> +        assertEquals(1.0, MapUtils.getDouble(in,"noKey", 1.0), 0);
>>>
>>>
>>>           final Map<String, String> inStr = new HashMap<>();
>>> @@ -970,12 +970,12 @@ public class MapUtilsTest extends
>>> AbstractAvailableLocalesTest {
>>>           final Map<String, Float> in = new HashMap<>();
>>>           in.put("key", 2.0f);
>>>
>>> -        assertEquals(MapUtils.getFloatValue(in,"key", 0.0f), 2.0, 0);
>>> -        assertEquals(MapUtils.getFloatValue(in,"key"), 2.0, 0);
>>> -        assertEquals(MapUtils.getFloatValue(in,"noKey", 1.0f), 1.0, 0);
>>> -        assertEquals(MapUtils.getFloatValue(in,"noKey"), 0, 0);
>>> -        assertEquals(MapUtils.getFloat(in,"key", 0.0f), 2.0, 0);
>>> -        assertEquals(MapUtils.getFloat(in,"noKey", 1.0f), 1.0, 0);
>>> +        assertEquals(2.0, MapUtils.getFloatValue(in,"key", 0.0f), 0);
>>> +        assertEquals(2.0, MapUtils.getFloatValue(in,"key"), 0);
>>> +        assertEquals(1.0, MapUtils.getFloatValue(in,"noKey", 1.0f), 0);
>>> +        assertEquals(0, MapUtils.getFloatValue(in,"noKey"), 0);
>>> +        assertEquals(2.0, MapUtils.getFloat(in,"key", 0.0f), 0);
>>> +        assertEquals(1.0, MapUtils.getFloat(in,"noKey", 1.0f), 0);
>>>
>>>           final Map<String, String> inStr = new HashMap<>();
>>>           char decimalSeparator = getDecimalSeparator();
>>> @@ -989,12 +989,12 @@ public class MapUtilsTest extends
>>> AbstractAvailableLocalesTest {
>>>           final Map<String, Long> in = new HashMap<>();
>>>           in.put("key", 2L);
>>>
>>> -        assertEquals(MapUtils.getLongValue(in,"key", 0L), 2.0, 0);
>>> -        assertEquals(MapUtils.getLongValue(in,"key"), 2.0, 0);
>>> -        assertEquals(MapUtils.getLongValue(in,"noKey", 1L), 1, 0);
>>> -        assertEquals(MapUtils.getLongValue(in,"noKey"), 0, 0);
>>> -        assertEquals(MapUtils.getLong(in,"key", 0L), 2.0, 0);
>>> -        assertEquals(MapUtils.getLong(in,"noKey", 1L), 1, 0);
>>> +        assertEquals(2.0, MapUtils.getLongValue(in,"key", 0L), 0);
>>> +        assertEquals(2.0, MapUtils.getLongValue(in,"key"), 0);
>>> +        assertEquals(1, MapUtils.getLongValue(in,"noKey", 1L), 0);
>>> +        assertEquals(0, MapUtils.getLongValue(in,"noKey"), 0);
>>> +        assertEquals(2.0, MapUtils.getLong(in,"key", 0L), 0);
>>> +        assertEquals(1, MapUtils.getLong(in,"noKey", 1L), 0);
>>>
>>>           final Map<String, String> inStr = new HashMap<>();
>>>           inStr.put("str1", "2");
>>> @@ -1009,12 +1009,12 @@ public class MapUtilsTest extends
>>> AbstractAvailableLocalesTest {
>>>           final Map<String, Integer> in = new HashMap<>();
>>>           in.put("key", 2);
>>>
>>> -        assertEquals(MapUtils.getIntValue(in,"key", 0), 2, 0);
>>> -        assertEquals(MapUtils.getIntValue(in,"key"), 2, 0);
>>> -        assertEquals(MapUtils.getIntValue(in,"noKey", 0), 0, 0);
>>> -        assertEquals(MapUtils.getIntValue(in,"noKey"), 0, 0);
>>> -        assertEquals(MapUtils.getInteger(in,"key", 0), 2, 0);
>>> -        assertEquals(MapUtils.getInteger(in,"noKey", 0), 0, 0);
>>> +        assertEquals(2, MapUtils.getIntValue(in,"key", 0), 0);
>>> +        assertEquals(2, MapUtils.getIntValue(in,"key"), 0);
>>> +        assertEquals(0, MapUtils.getIntValue(in,"noKey", 0), 0);
>>> +        assertEquals(0, MapUtils.getIntValue(in,"noKey"), 0);
>>> +        assertEquals(2, MapUtils.getInteger(in,"key", 0), 0);
>>> +        assertEquals(0, MapUtils.getInteger(in,"noKey", 0), 0);
>>>
>>>           final Map<String, String> inStr = new HashMap<>();
>>>           inStr.put("str1", "2");
>>> @@ -1028,12 +1028,12 @@ public class MapUtilsTest extends
>>> AbstractAvailableLocalesTest {
>>>           final short val = 10;
>>>           in.put("key", val);
>>>
>>> -        assertEquals(MapUtils.getShortValue(in,"key", val), val, 0);
>>> -        assertEquals(MapUtils.getShortValue(in,"key"), val, 0);
>>> -        assertEquals(MapUtils.getShortValue(in,"noKey", val), val, 0);
>>> -        assertEquals(MapUtils.getShortValue(in,"noKey"), 0, 0);
>>> -        assertEquals(MapUtils.getShort(in,"key", val), val, 0);
>>> -        assertEquals(MapUtils.getShort(in,"noKey", val), val, 0);
>>> +        assertEquals(val, MapUtils.getShortValue(in,"key", val), 0);
>>> +        assertEquals(val, MapUtils.getShortValue(in,"key"), 0);
>>> +        assertEquals(val, MapUtils.getShortValue(in,"noKey", val), 0);
>>> +        assertEquals(0, MapUtils.getShortValue(in,"noKey"), 0);
>>> +        assertEquals(val, MapUtils.getShort(in,"key", val), 0);
>>> +        assertEquals(val,MapUtils.getShort(in,"noKey", val), 0);
>>>
>>>           final Map<String, String> inStr = new HashMap<>();
>>>           inStr.put("str1", "10");
>>> @@ -1047,12 +1047,12 @@ public class MapUtilsTest extends
>>> AbstractAvailableLocalesTest {
>>>           final byte val = 100;
>>>           in.put("key", val);
>>>
>>> -        assertEquals(MapUtils.getByteValue(in,"key", val), val, 0);
>>> -        assertEquals(MapUtils.getByteValue(in,"key"), val, 0);
>>> -        assertEquals(MapUtils.getByteValue(in,"noKey", val), val, 0);
>>> -        assertEquals(MapUtils.getByteValue(in,"noKey"), 0, 0);
>>> -        assertEquals(MapUtils.getByte(in,"key", val), val, 0);
>>> -        assertEquals(MapUtils.getByte(in,"noKey", val), val, 0);
>>> +        assertEquals(val, MapUtils.getByteValue(in,"key", val), 0);
>>> +        assertEquals(val, MapUtils.getByteValue(in,"key"), 0);
>>> +        assertEquals(val, MapUtils.getByteValue(in,"noKey", val), 0);
>>> +        assertEquals(0, MapUtils.getByteValue(in,"noKey"), 0);
>>> +        assertEquals(val, MapUtils.getByte(in,"key", val), 0);
>>> +        assertEquals(val, MapUtils.getByte(in,"noKey", val), 0);
>>>
>>>
>>>           final Map<String, String> inStr = new HashMap<>();
>>> @@ -1067,8 +1067,8 @@ public class MapUtilsTest extends
>>> AbstractAvailableLocalesTest {
>>>           final Number val = 1000;
>>>           in.put("key", val);
>>>
>>> -        assertEquals(MapUtils.getNumber(in,"key", val).intValue(),
>>> val.intValue(), 0);
>>> -        assertEquals(MapUtils.getNumber(in,"noKey", val).intValue(),
>>> val.intValue(), 0);
>>> +        assertEquals(val.intValue(), MapUtils.getNumber(in,"key",
>>> val).intValue(), 0);
>>> +        assertEquals(val.intValue(), MapUtils.getNumber(in,"noKey",
>>> val).intValue(), 0);
>>>
>>>       }
>>>
>>> @@ -1077,11 +1077,11 @@ public class MapUtilsTest extends
>>> AbstractAvailableLocalesTest {
>>>           final Map<String, String> in = new HashMap<>();
>>>           in.put("key", "str");
>>>
>>> -        assertEquals(MapUtils.getString(in,"key", "defualt"), "str");
>>> -        assertEquals(MapUtils.getString(in,"key"), "str");
>>> -        assertEquals(MapUtils.getString(null,"key"), null);
>>> -        assertEquals(MapUtils.getString(in,"noKey", "default"),
>>> "default");
>>> -        assertEquals(MapUtils.getString(null,"noKey", "default"),
>>> "default");
>>> +        assertEquals("str", MapUtils.getString(in,"key", "defualt"));
>>> +        assertEquals("str", MapUtils.getString(in,"key"));
>>> +        assertEquals(null, MapUtils.getString(null,"key"));
>>> +        assertEquals("default", MapUtils.getString(in,"noKey",
>>> "default"));
>>> +        assertEquals("default", MapUtils.getString(null,"noKey",
>>> "default"));
>>>
>>>       }
>>>
>>> @@ -1090,11 +1090,11 @@ public class MapUtilsTest extends
>>> AbstractAvailableLocalesTest {
>>>           final Map<String, Object> in = new HashMap<>();
>>>           in.put("key", "str");
>>>
>>> -        assertEquals(MapUtils.getObject(in,"key", "defualt"), "str");
>>> -        assertEquals(MapUtils.getObject(in,"key"), "str");
>>> -        assertEquals(MapUtils.getObject(null,"key"), null);
>>> -        assertEquals(MapUtils.getObject(in,"noKey", "default"),
>>> "default");
>>> -        assertEquals(MapUtils.getObject(null,"noKey", "default"),
>>> "default");
>>> +        assertEquals("str", MapUtils.getObject(in,"key", "defualt"));
>>> +        assertEquals("str", MapUtils.getObject(in,"key"));
>>> +        assertEquals(null, MapUtils.getObject(null,"key"));
>>> +        assertEquals("default", MapUtils.getObject(in,"noKey",
>>> "default"));
>>> +        assertEquals("default", MapUtils.getObject(null,"noKey",
>>> "default"));
>>>
>>>       }
>>>
>>> @@ -1109,7 +1109,7 @@ public class MapUtilsTest extends
>>> AbstractAvailableLocalesTest {
>>>           assertTrue(!MapUtils.getBooleanValue(in,"noKey"));
>>>           assertTrue(MapUtils.getBoolean(in,"key", true));
>>>           assertTrue(MapUtils.getBoolean(in,"noKey", true));
>>> -        assertEquals(MapUtils.getBoolean(null,"noKey"),null);
>>> +        assertEquals(null, MapUtils.getBoolean(null,"noKey"));
>>>
>>>
>>>
>>> @@ -1130,10 +1130,10 @@ public class MapUtilsTest extends
>>> AbstractAvailableLocalesTest {
>>>           in.put("key1", valMap);
>>>           final Map<?, ?> outValue =  MapUtils.getMap(in,"key1", null);
>>>
>>> -        assertEquals( outValue.get("key1"), "value1");
>>> -        assertEquals( outValue.get("key2"), null);
>>> -        assertEquals( MapUtils.getMap(in,"key2", null), null);
>>> -        assertEquals( MapUtils.getMap(null,"key2", null), null);
>>> +        assertEquals("value1", outValue.get("key1"));
>>> +        assertEquals(null, outValue.get("key2"));
>>> +        assertEquals(null, MapUtils.getMap(in,"key2", null));
>>> +        assertEquals(null, MapUtils.getMap(null,"key2", null));
>>>       }
>>>
>>>       @Test
>>> @@ -1143,8 +1143,8 @@ public class MapUtilsTest extends
>>> AbstractAvailableLocalesTest {
>>>
>>>           MapUtils.safeAddToMap(inMap,"key1", "value1");
>>>           MapUtils.safeAddToMap(inMap,"key2", null);
>>> -        assertEquals( inMap.get("key1"), "value1");
>>> -        assertEquals( inMap.get("key2"), "");
>>> +        assertEquals("value1", inMap.get("key1"));
>>> +        assertEquals("", inMap.get("key2"));
>>>       }
>>>
>>>       @Test
>>>
>>>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: commons-collections git commit: MapUtilsTest: fix order of expected and actual parameter in assertions (closes #32)

garydgregory
I have no interest in switching from JUnit, especially with JUnit 5 around
the corner.

Gary

On Sat, Oct 14, 2017 at 12:25 PM, Pascal Schumacher <
[hidden email]> wrote:

> Any time. :-)
>
> Migrating is not hard, as there are scripts to do most of the work, see:
>
> https://joel-costigliola.github.io/assertj/assertj-core-
> converting-junit-assertions-to-assertj.html
>
> Am 14.10.2017 um 19:06 schrieb Benedikt Ritter:
>
>> About time we migrate to AssertJ. :-)
>>
>> Gary Gregory <[hidden email]> schrieb am Sa. 14. Okt. 2017 um
>> 18:55:
>>
>> Thank you for doing that! That was driving me nuts!
>>>
>>> Gary
>>>
>>> On Oct 14, 2017 10:53, <[hidden email]> wrote:
>>>
>>> Repository: commons-collections
>>>> Updated Branches:
>>>>    refs/heads/master 641aa1c66 -> b9522976f
>>>>
>>>>
>>>> MapUtilsTest: fix order of expected and actual parameter in assertions
>>>> (closes #32)
>>>>
>>>>
>>>> Project: http://git-wip-us.apache.org/repos/asf/commons-collections/r
>>>> epo
>>>> Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/
>>>> commit/b9522976
>>>> Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/
>>>> tree/b9522976
>>>> Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/
>>>> diff/b9522976
>>>>
>>>> Branch: refs/heads/master
>>>> Commit: b9522976f462687b0693b7229ba5c7faee0cb74b
>>>> Parents: 641aa1c
>>>> Author: Kavuri, Vamsi <[hidden email]>
>>>> Authored: Sat Oct 14 12:30:35 2017 -0400
>>>> Committer: pascalschumacher <[hidden email]>
>>>> Committed: Sat Oct 14 18:52:04 2017 +0200
>>>>
>>>> ----------------------------------------------------------------------
>>>>   .../commons/collections4/MapUtilsTest.java      | 110
>>>>
>>> +++++++++----------
>>>
>>>>   1 file changed, 55 insertions(+), 55 deletions(-)
>>>> ----------------------------------------------------------------------
>>>>
>>>>
>>>> http://git-wip-us.apache.org/repos/asf/commons-collections/
>>>> blob/b9522976/src/test/java/org/apache/commons/
>>>> collections4/MapUtilsTest.java
>>>> ----------------------------------------------------------------------
>>>> diff --git
>>>>
>>> a/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
>>>
>>>> b/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
>>>> index fc3e3d6..21f20c4 100644
>>>> --- a/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
>>>> +++ b/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
>>>> @@ -950,12 +950,12 @@ public class MapUtilsTest extends
>>>> AbstractAvailableLocalesTest {
>>>>           final Map<String, Double> in = new HashMap<>();
>>>>           in.put("key", 2.0);
>>>>
>>>> -        assertEquals(MapUtils.getDoubleValue(in,"key", 0.0), 2.0, 0);
>>>> -        assertEquals(MapUtils.getDoubleValue(in,"key"), 2.0, 0);
>>>> -        assertEquals(MapUtils.getDoubleValue(in,"noKey", 1.0), 1.0,
>>>> 0);
>>>> -        assertEquals(MapUtils.getDoubleValue(in,"noKey"), 0, 0);
>>>> -        assertEquals(MapUtils.getDouble(in,"key", 0.0), 2.0, 0);
>>>> -        assertEquals(MapUtils.getDouble(in,"noKey", 1.0), 1.0, 0);
>>>> +        assertEquals(2.0, MapUtils.getDoubleValue(in,"key", 0.0), 0);
>>>> +        assertEquals(2.0, MapUtils.getDoubleValue(in,"key"), 0);
>>>> +        assertEquals(1.0, MapUtils.getDoubleValue(in,"noKey", 1.0),
>>>> 0);
>>>> +        assertEquals(0, MapUtils.getDoubleValue(in,"noKey"), 0);
>>>> +        assertEquals(2.0, MapUtils.getDouble(in,"key", 0.0), 0);
>>>> +        assertEquals(1.0, MapUtils.getDouble(in,"noKey", 1.0), 0);
>>>>
>>>>
>>>>           final Map<String, String> inStr = new HashMap<>();
>>>> @@ -970,12 +970,12 @@ public class MapUtilsTest extends
>>>> AbstractAvailableLocalesTest {
>>>>           final Map<String, Float> in = new HashMap<>();
>>>>           in.put("key", 2.0f);
>>>>
>>>> -        assertEquals(MapUtils.getFloatValue(in,"key", 0.0f), 2.0, 0);
>>>> -        assertEquals(MapUtils.getFloatValue(in,"key"), 2.0, 0);
>>>> -        assertEquals(MapUtils.getFloatValue(in,"noKey", 1.0f), 1.0,
>>>> 0);
>>>> -        assertEquals(MapUtils.getFloatValue(in,"noKey"), 0, 0);
>>>> -        assertEquals(MapUtils.getFloat(in,"key", 0.0f), 2.0, 0);
>>>> -        assertEquals(MapUtils.getFloat(in,"noKey", 1.0f), 1.0, 0);
>>>> +        assertEquals(2.0, MapUtils.getFloatValue(in,"key", 0.0f), 0);
>>>> +        assertEquals(2.0, MapUtils.getFloatValue(in,"key"), 0);
>>>> +        assertEquals(1.0, MapUtils.getFloatValue(in,"noKey", 1.0f),
>>>> 0);
>>>> +        assertEquals(0, MapUtils.getFloatValue(in,"noKey"), 0);
>>>> +        assertEquals(2.0, MapUtils.getFloat(in,"key", 0.0f), 0);
>>>> +        assertEquals(1.0, MapUtils.getFloat(in,"noKey", 1.0f), 0);
>>>>
>>>>           final Map<String, String> inStr = new HashMap<>();
>>>>           char decimalSeparator = getDecimalSeparator();
>>>> @@ -989,12 +989,12 @@ public class MapUtilsTest extends
>>>> AbstractAvailableLocalesTest {
>>>>           final Map<String, Long> in = new HashMap<>();
>>>>           in.put("key", 2L);
>>>>
>>>> -        assertEquals(MapUtils.getLongValue(in,"key", 0L), 2.0, 0);
>>>> -        assertEquals(MapUtils.getLongValue(in,"key"), 2.0, 0);
>>>> -        assertEquals(MapUtils.getLongValue(in,"noKey", 1L), 1, 0);
>>>> -        assertEquals(MapUtils.getLongValue(in,"noKey"), 0, 0);
>>>> -        assertEquals(MapUtils.getLong(in,"key", 0L), 2.0, 0);
>>>> -        assertEquals(MapUtils.getLong(in,"noKey", 1L), 1, 0);
>>>> +        assertEquals(2.0, MapUtils.getLongValue(in,"key", 0L), 0);
>>>> +        assertEquals(2.0, MapUtils.getLongValue(in,"key"), 0);
>>>> +        assertEquals(1, MapUtils.getLongValue(in,"noKey", 1L), 0);
>>>> +        assertEquals(0, MapUtils.getLongValue(in,"noKey"), 0);
>>>> +        assertEquals(2.0, MapUtils.getLong(in,"key", 0L), 0);
>>>> +        assertEquals(1, MapUtils.getLong(in,"noKey", 1L), 0);
>>>>
>>>>           final Map<String, String> inStr = new HashMap<>();
>>>>           inStr.put("str1", "2");
>>>> @@ -1009,12 +1009,12 @@ public class MapUtilsTest extends
>>>> AbstractAvailableLocalesTest {
>>>>           final Map<String, Integer> in = new HashMap<>();
>>>>           in.put("key", 2);
>>>>
>>>> -        assertEquals(MapUtils.getIntValue(in,"key", 0), 2, 0);
>>>> -        assertEquals(MapUtils.getIntValue(in,"key"), 2, 0);
>>>> -        assertEquals(MapUtils.getIntValue(in,"noKey", 0), 0, 0);
>>>> -        assertEquals(MapUtils.getIntValue(in,"noKey"), 0, 0);
>>>> -        assertEquals(MapUtils.getInteger(in,"key", 0), 2, 0);
>>>> -        assertEquals(MapUtils.getInteger(in,"noKey", 0), 0, 0);
>>>> +        assertEquals(2, MapUtils.getIntValue(in,"key", 0), 0);
>>>> +        assertEquals(2, MapUtils.getIntValue(in,"key"), 0);
>>>> +        assertEquals(0, MapUtils.getIntValue(in,"noKey", 0), 0);
>>>> +        assertEquals(0, MapUtils.getIntValue(in,"noKey"), 0);
>>>> +        assertEquals(2, MapUtils.getInteger(in,"key", 0), 0);
>>>> +        assertEquals(0, MapUtils.getInteger(in,"noKey", 0), 0);
>>>>
>>>>           final Map<String, String> inStr = new HashMap<>();
>>>>           inStr.put("str1", "2");
>>>> @@ -1028,12 +1028,12 @@ public class MapUtilsTest extends
>>>> AbstractAvailableLocalesTest {
>>>>           final short val = 10;
>>>>           in.put("key", val);
>>>>
>>>> -        assertEquals(MapUtils.getShortValue(in,"key", val), val, 0);
>>>> -        assertEquals(MapUtils.getShortValue(in,"key"), val, 0);
>>>> -        assertEquals(MapUtils.getShortValue(in,"noKey", val), val, 0);
>>>> -        assertEquals(MapUtils.getShortValue(in,"noKey"), 0, 0);
>>>> -        assertEquals(MapUtils.getShort(in,"key", val), val, 0);
>>>> -        assertEquals(MapUtils.getShort(in,"noKey", val), val, 0);
>>>> +        assertEquals(val, MapUtils.getShortValue(in,"key", val), 0);
>>>> +        assertEquals(val, MapUtils.getShortValue(in,"key"), 0);
>>>> +        assertEquals(val, MapUtils.getShortValue(in,"noKey", val), 0);
>>>> +        assertEquals(0, MapUtils.getShortValue(in,"noKey"), 0);
>>>> +        assertEquals(val, MapUtils.getShort(in,"key", val), 0);
>>>> +        assertEquals(val,MapUtils.getShort(in,"noKey", val), 0);
>>>>
>>>>           final Map<String, String> inStr = new HashMap<>();
>>>>           inStr.put("str1", "10");
>>>> @@ -1047,12 +1047,12 @@ public class MapUtilsTest extends
>>>> AbstractAvailableLocalesTest {
>>>>           final byte val = 100;
>>>>           in.put("key", val);
>>>>
>>>> -        assertEquals(MapUtils.getByteValue(in,"key", val), val, 0);
>>>> -        assertEquals(MapUtils.getByteValue(in,"key"), val, 0);
>>>> -        assertEquals(MapUtils.getByteValue(in,"noKey", val), val, 0);
>>>> -        assertEquals(MapUtils.getByteValue(in,"noKey"), 0, 0);
>>>> -        assertEquals(MapUtils.getByte(in,"key", val), val, 0);
>>>> -        assertEquals(MapUtils.getByte(in,"noKey", val), val, 0);
>>>> +        assertEquals(val, MapUtils.getByteValue(in,"key", val), 0);
>>>> +        assertEquals(val, MapUtils.getByteValue(in,"key"), 0);
>>>> +        assertEquals(val, MapUtils.getByteValue(in,"noKey", val), 0);
>>>> +        assertEquals(0, MapUtils.getByteValue(in,"noKey"), 0);
>>>> +        assertEquals(val, MapUtils.getByte(in,"key", val), 0);
>>>> +        assertEquals(val, MapUtils.getByte(in,"noKey", val), 0);
>>>>
>>>>
>>>>           final Map<String, String> inStr = new HashMap<>();
>>>> @@ -1067,8 +1067,8 @@ public class MapUtilsTest extends
>>>> AbstractAvailableLocalesTest {
>>>>           final Number val = 1000;
>>>>           in.put("key", val);
>>>>
>>>> -        assertEquals(MapUtils.getNumber(in,"key", val).intValue(),
>>>> val.intValue(), 0);
>>>> -        assertEquals(MapUtils.getNumber(in,"noKey", val).intValue(),
>>>> val.intValue(), 0);
>>>> +        assertEquals(val.intValue(), MapUtils.getNumber(in,"key",
>>>> val).intValue(), 0);
>>>> +        assertEquals(val.intValue(), MapUtils.getNumber(in,"noKey",
>>>> val).intValue(), 0);
>>>>
>>>>       }
>>>>
>>>> @@ -1077,11 +1077,11 @@ public class MapUtilsTest extends
>>>> AbstractAvailableLocalesTest {
>>>>           final Map<String, String> in = new HashMap<>();
>>>>           in.put("key", "str");
>>>>
>>>> -        assertEquals(MapUtils.getString(in,"key", "defualt"), "str");
>>>> -        assertEquals(MapUtils.getString(in,"key"), "str");
>>>> -        assertEquals(MapUtils.getString(null,"key"), null);
>>>> -        assertEquals(MapUtils.getString(in,"noKey", "default"),
>>>> "default");
>>>> -        assertEquals(MapUtils.getString(null,"noKey", "default"),
>>>> "default");
>>>> +        assertEquals("str", MapUtils.getString(in,"key", "defualt"));
>>>> +        assertEquals("str", MapUtils.getString(in,"key"));
>>>> +        assertEquals(null, MapUtils.getString(null,"key"));
>>>> +        assertEquals("default", MapUtils.getString(in,"noKey",
>>>> "default"));
>>>> +        assertEquals("default", MapUtils.getString(null,"noKey",
>>>> "default"));
>>>>
>>>>       }
>>>>
>>>> @@ -1090,11 +1090,11 @@ public class MapUtilsTest extends
>>>> AbstractAvailableLocalesTest {
>>>>           final Map<String, Object> in = new HashMap<>();
>>>>           in.put("key", "str");
>>>>
>>>> -        assertEquals(MapUtils.getObject(in,"key", "defualt"), "str");
>>>> -        assertEquals(MapUtils.getObject(in,"key"), "str");
>>>> -        assertEquals(MapUtils.getObject(null,"key"), null);
>>>> -        assertEquals(MapUtils.getObject(in,"noKey", "default"),
>>>> "default");
>>>> -        assertEquals(MapUtils.getObject(null,"noKey", "default"),
>>>> "default");
>>>> +        assertEquals("str", MapUtils.getObject(in,"key", "defualt"));
>>>> +        assertEquals("str", MapUtils.getObject(in,"key"));
>>>> +        assertEquals(null, MapUtils.getObject(null,"key"));
>>>> +        assertEquals("default", MapUtils.getObject(in,"noKey",
>>>> "default"));
>>>> +        assertEquals("default", MapUtils.getObject(null,"noKey",
>>>> "default"));
>>>>
>>>>       }
>>>>
>>>> @@ -1109,7 +1109,7 @@ public class MapUtilsTest extends
>>>> AbstractAvailableLocalesTest {
>>>>           assertTrue(!MapUtils.getBooleanValue(in,"noKey"));
>>>>           assertTrue(MapUtils.getBoolean(in,"key", true));
>>>>           assertTrue(MapUtils.getBoolean(in,"noKey", true));
>>>> -        assertEquals(MapUtils.getBoolean(null,"noKey"),null);
>>>> +        assertEquals(null, MapUtils.getBoolean(null,"noKey"));
>>>>
>>>>
>>>>
>>>> @@ -1130,10 +1130,10 @@ public class MapUtilsTest extends
>>>> AbstractAvailableLocalesTest {
>>>>           in.put("key1", valMap);
>>>>           final Map<?, ?> outValue =  MapUtils.getMap(in,"key1", null);
>>>>
>>>> -        assertEquals( outValue.get("key1"), "value1");
>>>> -        assertEquals( outValue.get("key2"), null);
>>>> -        assertEquals( MapUtils.getMap(in,"key2", null), null);
>>>> -        assertEquals( MapUtils.getMap(null,"key2", null), null);
>>>> +        assertEquals("value1", outValue.get("key1"));
>>>> +        assertEquals(null, outValue.get("key2"));
>>>> +        assertEquals(null, MapUtils.getMap(in,"key2", null));
>>>> +        assertEquals(null, MapUtils.getMap(null,"key2", null));
>>>>       }
>>>>
>>>>       @Test
>>>> @@ -1143,8 +1143,8 @@ public class MapUtilsTest extends
>>>> AbstractAvailableLocalesTest {
>>>>
>>>>           MapUtils.safeAddToMap(inMap,"key1", "value1");
>>>>           MapUtils.safeAddToMap(inMap,"key2", null);
>>>> -        assertEquals( inMap.get("key1"), "value1");
>>>> -        assertEquals( inMap.get("key2"), "");
>>>> +        assertEquals("value1", inMap.get("key1"));
>>>> +        assertEquals("", inMap.get("key2"));
>>>>       }
>>>>
>>>>       @Test
>>>>
>>>>
>>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: commons-collections git commit: MapUtilsTest: fix order of expected and actual parameter in assertions (closes #32)

Matt Sicker
AssertJ is an assertion library and works with JUnit or whatever testing
framework you want. Essentially, it's a replacement for Hamcrest +
org.junit.Assert.

On 14 October 2017 at 13:27, Gary Gregory <[hidden email]> wrote:

> I have no interest in switching from JUnit, especially with JUnit 5 around
> the corner.
>
> Gary
>
> On Sat, Oct 14, 2017 at 12:25 PM, Pascal Schumacher <
> [hidden email]> wrote:
>
> > Any time. :-)
> >
> > Migrating is not hard, as there are scripts to do most of the work, see:
> >
> > https://joel-costigliola.github.io/assertj/assertj-core-
> > converting-junit-assertions-to-assertj.html
> >
> > Am 14.10.2017 um 19:06 schrieb Benedikt Ritter:
> >
> >> About time we migrate to AssertJ. :-)
> >>
> >> Gary Gregory <[hidden email]> schrieb am Sa. 14. Okt. 2017 um
> >> 18:55:
> >>
> >> Thank you for doing that! That was driving me nuts!
> >>>
> >>> Gary
> >>>
> >>> On Oct 14, 2017 10:53, <[hidden email]> wrote:
> >>>
> >>> Repository: commons-collections
> >>>> Updated Branches:
> >>>>    refs/heads/master 641aa1c66 -> b9522976f
> >>>>
> >>>>
> >>>> MapUtilsTest: fix order of expected and actual parameter in assertions
> >>>> (closes #32)
> >>>>
> >>>>
> >>>> Project: http://git-wip-us.apache.org/repos/asf/commons-collections/r
> >>>> epo
> >>>> Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/
> >>>> commit/b9522976
> >>>> Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/
> >>>> tree/b9522976
> >>>> Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/
> >>>> diff/b9522976
> >>>>
> >>>> Branch: refs/heads/master
> >>>> Commit: b9522976f462687b0693b7229ba5c7faee0cb74b
> >>>> Parents: 641aa1c
> >>>> Author: Kavuri, Vamsi <[hidden email]>
> >>>> Authored: Sat Oct 14 12:30:35 2017 -0400
> >>>> Committer: pascalschumacher <[hidden email]>
> >>>> Committed: Sat Oct 14 18:52:04 2017 +0200
> >>>>
> >>>> ------------------------------------------------------------
> ----------
> >>>>   .../commons/collections4/MapUtilsTest.java      | 110
> >>>>
> >>> +++++++++----------
> >>>
> >>>>   1 file changed, 55 insertions(+), 55 deletions(-)
> >>>> ------------------------------------------------------------
> ----------
> >>>>
> >>>>
> >>>> http://git-wip-us.apache.org/repos/asf/commons-collections/
> >>>> blob/b9522976/src/test/java/org/apache/commons/
> >>>> collections4/MapUtilsTest.java
> >>>> ------------------------------------------------------------
> ----------
> >>>> diff --git
> >>>>
> >>> a/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
> >>>
> >>>> b/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
> >>>> index fc3e3d6..21f20c4 100644
> >>>> --- a/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
> >>>> +++ b/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
> >>>> @@ -950,12 +950,12 @@ public class MapUtilsTest extends
> >>>> AbstractAvailableLocalesTest {
> >>>>           final Map<String, Double> in = new HashMap<>();
> >>>>           in.put("key", 2.0);
> >>>>
> >>>> -        assertEquals(MapUtils.getDoubleValue(in,"key", 0.0), 2.0,
> 0);
> >>>> -        assertEquals(MapUtils.getDoubleValue(in,"key"), 2.0, 0);
> >>>> -        assertEquals(MapUtils.getDoubleValue(in,"noKey", 1.0), 1.0,
> >>>> 0);
> >>>> -        assertEquals(MapUtils.getDoubleValue(in,"noKey"), 0, 0);
> >>>> -        assertEquals(MapUtils.getDouble(in,"key", 0.0), 2.0, 0);
> >>>> -        assertEquals(MapUtils.getDouble(in,"noKey", 1.0), 1.0, 0);
> >>>> +        assertEquals(2.0, MapUtils.getDoubleValue(in,"key", 0.0),
> 0);
> >>>> +        assertEquals(2.0, MapUtils.getDoubleValue(in,"key"), 0);
> >>>> +        assertEquals(1.0, MapUtils.getDoubleValue(in,"noKey", 1.0),
> >>>> 0);
> >>>> +        assertEquals(0, MapUtils.getDoubleValue(in,"noKey"), 0);
> >>>> +        assertEquals(2.0, MapUtils.getDouble(in,"key", 0.0), 0);
> >>>> +        assertEquals(1.0, MapUtils.getDouble(in,"noKey", 1.0), 0);
> >>>>
> >>>>
> >>>>           final Map<String, String> inStr = new HashMap<>();
> >>>> @@ -970,12 +970,12 @@ public class MapUtilsTest extends
> >>>> AbstractAvailableLocalesTest {
> >>>>           final Map<String, Float> in = new HashMap<>();
> >>>>           in.put("key", 2.0f);
> >>>>
> >>>> -        assertEquals(MapUtils.getFloatValue(in,"key", 0.0f), 2.0,
> 0);
> >>>> -        assertEquals(MapUtils.getFloatValue(in,"key"), 2.0, 0);
> >>>> -        assertEquals(MapUtils.getFloatValue(in,"noKey", 1.0f), 1.0,
> >>>> 0);
> >>>> -        assertEquals(MapUtils.getFloatValue(in,"noKey"), 0, 0);
> >>>> -        assertEquals(MapUtils.getFloat(in,"key", 0.0f), 2.0, 0);
> >>>> -        assertEquals(MapUtils.getFloat(in,"noKey", 1.0f), 1.0, 0);
> >>>> +        assertEquals(2.0, MapUtils.getFloatValue(in,"key", 0.0f),
> 0);
> >>>> +        assertEquals(2.0, MapUtils.getFloatValue(in,"key"), 0);
> >>>> +        assertEquals(1.0, MapUtils.getFloatValue(in,"noKey", 1.0f),
> >>>> 0);
> >>>> +        assertEquals(0, MapUtils.getFloatValue(in,"noKey"), 0);
> >>>> +        assertEquals(2.0, MapUtils.getFloat(in,"key", 0.0f), 0);
> >>>> +        assertEquals(1.0, MapUtils.getFloat(in,"noKey", 1.0f), 0);
> >>>>
> >>>>           final Map<String, String> inStr = new HashMap<>();
> >>>>           char decimalSeparator = getDecimalSeparator();
> >>>> @@ -989,12 +989,12 @@ public class MapUtilsTest extends
> >>>> AbstractAvailableLocalesTest {
> >>>>           final Map<String, Long> in = new HashMap<>();
> >>>>           in.put("key", 2L);
> >>>>
> >>>> -        assertEquals(MapUtils.getLongValue(in,"key", 0L), 2.0, 0);
> >>>> -        assertEquals(MapUtils.getLongValue(in,"key"), 2.0, 0);
> >>>> -        assertEquals(MapUtils.getLongValue(in,"noKey", 1L), 1, 0);
> >>>> -        assertEquals(MapUtils.getLongValue(in,"noKey"), 0, 0);
> >>>> -        assertEquals(MapUtils.getLong(in,"key", 0L), 2.0, 0);
> >>>> -        assertEquals(MapUtils.getLong(in,"noKey", 1L), 1, 0);
> >>>> +        assertEquals(2.0, MapUtils.getLongValue(in,"key", 0L), 0);
> >>>> +        assertEquals(2.0, MapUtils.getLongValue(in,"key"), 0);
> >>>> +        assertEquals(1, MapUtils.getLongValue(in,"noKey", 1L), 0);
> >>>> +        assertEquals(0, MapUtils.getLongValue(in,"noKey"), 0);
> >>>> +        assertEquals(2.0, MapUtils.getLong(in,"key", 0L), 0);
> >>>> +        assertEquals(1, MapUtils.getLong(in,"noKey", 1L), 0);
> >>>>
> >>>>           final Map<String, String> inStr = new HashMap<>();
> >>>>           inStr.put("str1", "2");
> >>>> @@ -1009,12 +1009,12 @@ public class MapUtilsTest extends
> >>>> AbstractAvailableLocalesTest {
> >>>>           final Map<String, Integer> in = new HashMap<>();
> >>>>           in.put("key", 2);
> >>>>
> >>>> -        assertEquals(MapUtils.getIntValue(in,"key", 0), 2, 0);
> >>>> -        assertEquals(MapUtils.getIntValue(in,"key"), 2, 0);
> >>>> -        assertEquals(MapUtils.getIntValue(in,"noKey", 0), 0, 0);
> >>>> -        assertEquals(MapUtils.getIntValue(in,"noKey"), 0, 0);
> >>>> -        assertEquals(MapUtils.getInteger(in,"key", 0), 2, 0);
> >>>> -        assertEquals(MapUtils.getInteger(in,"noKey", 0), 0, 0);
> >>>> +        assertEquals(2, MapUtils.getIntValue(in,"key", 0), 0);
> >>>> +        assertEquals(2, MapUtils.getIntValue(in,"key"), 0);
> >>>> +        assertEquals(0, MapUtils.getIntValue(in,"noKey", 0), 0);
> >>>> +        assertEquals(0, MapUtils.getIntValue(in,"noKey"), 0);
> >>>> +        assertEquals(2, MapUtils.getInteger(in,"key", 0), 0);
> >>>> +        assertEquals(0, MapUtils.getInteger(in,"noKey", 0), 0);
> >>>>
> >>>>           final Map<String, String> inStr = new HashMap<>();
> >>>>           inStr.put("str1", "2");
> >>>> @@ -1028,12 +1028,12 @@ public class MapUtilsTest extends
> >>>> AbstractAvailableLocalesTest {
> >>>>           final short val = 10;
> >>>>           in.put("key", val);
> >>>>
> >>>> -        assertEquals(MapUtils.getShortValue(in,"key", val), val, 0);
> >>>> -        assertEquals(MapUtils.getShortValue(in,"key"), val, 0);
> >>>> -        assertEquals(MapUtils.getShortValue(in,"noKey", val), val,
> 0);
> >>>> -        assertEquals(MapUtils.getShortValue(in,"noKey"), 0, 0);
> >>>> -        assertEquals(MapUtils.getShort(in,"key", val), val, 0);
> >>>> -        assertEquals(MapUtils.getShort(in,"noKey", val), val, 0);
> >>>> +        assertEquals(val, MapUtils.getShortValue(in,"key", val), 0);
> >>>> +        assertEquals(val, MapUtils.getShortValue(in,"key"), 0);
> >>>> +        assertEquals(val, MapUtils.getShortValue(in,"noKey", val),
> 0);
> >>>> +        assertEquals(0, MapUtils.getShortValue(in,"noKey"), 0);
> >>>> +        assertEquals(val, MapUtils.getShort(in,"key", val), 0);
> >>>> +        assertEquals(val,MapUtils.getShort(in,"noKey", val), 0);
> >>>>
> >>>>           final Map<String, String> inStr = new HashMap<>();
> >>>>           inStr.put("str1", "10");
> >>>> @@ -1047,12 +1047,12 @@ public class MapUtilsTest extends
> >>>> AbstractAvailableLocalesTest {
> >>>>           final byte val = 100;
> >>>>           in.put("key", val);
> >>>>
> >>>> -        assertEquals(MapUtils.getByteValue(in,"key", val), val, 0);
> >>>> -        assertEquals(MapUtils.getByteValue(in,"key"), val, 0);
> >>>> -        assertEquals(MapUtils.getByteValue(in,"noKey", val), val,
> 0);
> >>>> -        assertEquals(MapUtils.getByteValue(in,"noKey"), 0, 0);
> >>>> -        assertEquals(MapUtils.getByte(in,"key", val), val, 0);
> >>>> -        assertEquals(MapUtils.getByte(in,"noKey", val), val, 0);
> >>>> +        assertEquals(val, MapUtils.getByteValue(in,"key", val), 0);
> >>>> +        assertEquals(val, MapUtils.getByteValue(in,"key"), 0);
> >>>> +        assertEquals(val, MapUtils.getByteValue(in,"noKey", val),
> 0);
> >>>> +        assertEquals(0, MapUtils.getByteValue(in,"noKey"), 0);
> >>>> +        assertEquals(val, MapUtils.getByte(in,"key", val), 0);
> >>>> +        assertEquals(val, MapUtils.getByte(in,"noKey", val), 0);
> >>>>
> >>>>
> >>>>           final Map<String, String> inStr = new HashMap<>();
> >>>> @@ -1067,8 +1067,8 @@ public class MapUtilsTest extends
> >>>> AbstractAvailableLocalesTest {
> >>>>           final Number val = 1000;
> >>>>           in.put("key", val);
> >>>>
> >>>> -        assertEquals(MapUtils.getNumber(in,"key", val).intValue(),
> >>>> val.intValue(), 0);
> >>>> -        assertEquals(MapUtils.getNumber(in,"noKey", val).intValue(),
> >>>> val.intValue(), 0);
> >>>> +        assertEquals(val.intValue(), MapUtils.getNumber(in,"key",
> >>>> val).intValue(), 0);
> >>>> +        assertEquals(val.intValue(), MapUtils.getNumber(in,"noKey",
> >>>> val).intValue(), 0);
> >>>>
> >>>>       }
> >>>>
> >>>> @@ -1077,11 +1077,11 @@ public class MapUtilsTest extends
> >>>> AbstractAvailableLocalesTest {
> >>>>           final Map<String, String> in = new HashMap<>();
> >>>>           in.put("key", "str");
> >>>>
> >>>> -        assertEquals(MapUtils.getString(in,"key", "defualt"),
> "str");
> >>>> -        assertEquals(MapUtils.getString(in,"key"), "str");
> >>>> -        assertEquals(MapUtils.getString(null,"key"), null);
> >>>> -        assertEquals(MapUtils.getString(in,"noKey", "default"),
> >>>> "default");
> >>>> -        assertEquals(MapUtils.getString(null,"noKey", "default"),
> >>>> "default");
> >>>> +        assertEquals("str", MapUtils.getString(in,"key", "defualt"));
> >>>> +        assertEquals("str", MapUtils.getString(in,"key"));
> >>>> +        assertEquals(null, MapUtils.getString(null,"key"));
> >>>> +        assertEquals("default", MapUtils.getString(in,"noKey",
> >>>> "default"));
> >>>> +        assertEquals("default", MapUtils.getString(null,"noKey",
> >>>> "default"));
> >>>>
> >>>>       }
> >>>>
> >>>> @@ -1090,11 +1090,11 @@ public class MapUtilsTest extends
> >>>> AbstractAvailableLocalesTest {
> >>>>           final Map<String, Object> in = new HashMap<>();
> >>>>           in.put("key", "str");
> >>>>
> >>>> -        assertEquals(MapUtils.getObject(in,"key", "defualt"),
> "str");
> >>>> -        assertEquals(MapUtils.getObject(in,"key"), "str");
> >>>> -        assertEquals(MapUtils.getObject(null,"key"), null);
> >>>> -        assertEquals(MapUtils.getObject(in,"noKey", "default"),
> >>>> "default");
> >>>> -        assertEquals(MapUtils.getObject(null,"noKey", "default"),
> >>>> "default");
> >>>> +        assertEquals("str", MapUtils.getObject(in,"key", "defualt"));
> >>>> +        assertEquals("str", MapUtils.getObject(in,"key"));
> >>>> +        assertEquals(null, MapUtils.getObject(null,"key"));
> >>>> +        assertEquals("default", MapUtils.getObject(in,"noKey",
> >>>> "default"));
> >>>> +        assertEquals("default", MapUtils.getObject(null,"noKey",
> >>>> "default"));
> >>>>
> >>>>       }
> >>>>
> >>>> @@ -1109,7 +1109,7 @@ public class MapUtilsTest extends
> >>>> AbstractAvailableLocalesTest {
> >>>>           assertTrue(!MapUtils.getBooleanValue(in,"noKey"));
> >>>>           assertTrue(MapUtils.getBoolean(in,"key", true));
> >>>>           assertTrue(MapUtils.getBoolean(in,"noKey", true));
> >>>> -        assertEquals(MapUtils.getBoolean(null,"noKey"),null);
> >>>> +        assertEquals(null, MapUtils.getBoolean(null,"noKey"));
> >>>>
> >>>>
> >>>>
> >>>> @@ -1130,10 +1130,10 @@ public class MapUtilsTest extends
> >>>> AbstractAvailableLocalesTest {
> >>>>           in.put("key1", valMap);
> >>>>           final Map<?, ?> outValue =  MapUtils.getMap(in,"key1",
> null);
> >>>>
> >>>> -        assertEquals( outValue.get("key1"), "value1");
> >>>> -        assertEquals( outValue.get("key2"), null);
> >>>> -        assertEquals( MapUtils.getMap(in,"key2", null), null);
> >>>> -        assertEquals( MapUtils.getMap(null,"key2", null), null);
> >>>> +        assertEquals("value1", outValue.get("key1"));
> >>>> +        assertEquals(null, outValue.get("key2"));
> >>>> +        assertEquals(null, MapUtils.getMap(in,"key2", null));
> >>>> +        assertEquals(null, MapUtils.getMap(null,"key2", null));
> >>>>       }
> >>>>
> >>>>       @Test
> >>>> @@ -1143,8 +1143,8 @@ public class MapUtilsTest extends
> >>>> AbstractAvailableLocalesTest {
> >>>>
> >>>>           MapUtils.safeAddToMap(inMap,"key1", "value1");
> >>>>           MapUtils.safeAddToMap(inMap,"key2", null);
> >>>> -        assertEquals( inMap.get("key1"), "value1");
> >>>> -        assertEquals( inMap.get("key2"), "");
> >>>> +        assertEquals("value1", inMap.get("key1"));
> >>>> +        assertEquals("", inMap.get("key2"));
> >>>>       }
> >>>>
> >>>>       @Test
> >>>>
> >>>>
> >>>>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>



--
Matt Sicker <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: commons-collections git commit: MapUtilsTest: fix order of expected and actual parameter in assertions (closes #32)

garydgregory
How does it compare to RelaxNG?

G

On Sat, Oct 14, 2017 at 12:49 PM, Matt Sicker <[hidden email]> wrote:

> AssertJ is an assertion library and works with JUnit or whatever testing
> framework you want. Essentially, it's a replacement for Hamcrest +
> org.junit.Assert.
>
> On 14 October 2017 at 13:27, Gary Gregory <[hidden email]> wrote:
>
> > I have no interest in switching from JUnit, especially with JUnit 5
> around
> > the corner.
> >
> > Gary
> >
> > On Sat, Oct 14, 2017 at 12:25 PM, Pascal Schumacher <
> > [hidden email]> wrote:
> >
> > > Any time. :-)
> > >
> > > Migrating is not hard, as there are scripts to do most of the work,
> see:
> > >
> > > https://joel-costigliola.github.io/assertj/assertj-core-
> > > converting-junit-assertions-to-assertj.html
> > >
> > > Am 14.10.2017 um 19:06 schrieb Benedikt Ritter:
> > >
> > >> About time we migrate to AssertJ. :-)
> > >>
> > >> Gary Gregory <[hidden email]> schrieb am Sa. 14. Okt. 2017 um
> > >> 18:55:
> > >>
> > >> Thank you for doing that! That was driving me nuts!
> > >>>
> > >>> Gary
> > >>>
> > >>> On Oct 14, 2017 10:53, <[hidden email]> wrote:
> > >>>
> > >>> Repository: commons-collections
> > >>>> Updated Branches:
> > >>>>    refs/heads/master 641aa1c66 -> b9522976f
> > >>>>
> > >>>>
> > >>>> MapUtilsTest: fix order of expected and actual parameter in
> assertions
> > >>>> (closes #32)
> > >>>>
> > >>>>
> > >>>> Project: http://git-wip-us.apache.org/
> repos/asf/commons-collections/r
> > >>>> epo
> > >>>> Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/
> > >>>> commit/b9522976
> > >>>> Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/
> > >>>> tree/b9522976
> > >>>> Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/
> > >>>> diff/b9522976
> > >>>>
> > >>>> Branch: refs/heads/master
> > >>>> Commit: b9522976f462687b0693b7229ba5c7faee0cb74b
> > >>>> Parents: 641aa1c
> > >>>> Author: Kavuri, Vamsi <[hidden email]>
> > >>>> Authored: Sat Oct 14 12:30:35 2017 -0400
> > >>>> Committer: pascalschumacher <[hidden email]>
> > >>>> Committed: Sat Oct 14 18:52:04 2017 +0200
> > >>>>
> > >>>> ------------------------------------------------------------
> > ----------
> > >>>>   .../commons/collections4/MapUtilsTest.java      | 110
> > >>>>
> > >>> +++++++++----------
> > >>>
> > >>>>   1 file changed, 55 insertions(+), 55 deletions(-)
> > >>>> ------------------------------------------------------------
> > ----------
> > >>>>
> > >>>>
> > >>>> http://git-wip-us.apache.org/repos/asf/commons-collections/
> > >>>> blob/b9522976/src/test/java/org/apache/commons/
> > >>>> collections4/MapUtilsTest.java
> > >>>> ------------------------------------------------------------
> > ----------
> > >>>> diff --git
> > >>>>
> > >>> a/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
> > >>>
> > >>>> b/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
> > >>>> index fc3e3d6..21f20c4 100644
> > >>>> --- a/src/test/java/org/apache/commons/collections4/
> MapUtilsTest.java
> > >>>> +++ b/src/test/java/org/apache/commons/collections4/
> MapUtilsTest.java
> > >>>> @@ -950,12 +950,12 @@ public class MapUtilsTest extends
> > >>>> AbstractAvailableLocalesTest {
> > >>>>           final Map<String, Double> in = new HashMap<>();
> > >>>>           in.put("key", 2.0);
> > >>>>
> > >>>> -        assertEquals(MapUtils.getDoubleValue(in,"key", 0.0), 2.0,
> > 0);
> > >>>> -        assertEquals(MapUtils.getDoubleValue(in,"key"), 2.0, 0);
> > >>>> -        assertEquals(MapUtils.getDoubleValue(in,"noKey", 1.0),
> 1.0,
> > >>>> 0);
> > >>>> -        assertEquals(MapUtils.getDoubleValue(in,"noKey"), 0, 0);
> > >>>> -        assertEquals(MapUtils.getDouble(in,"key", 0.0), 2.0, 0);
> > >>>> -        assertEquals(MapUtils.getDouble(in,"noKey", 1.0), 1.0, 0);
> > >>>> +        assertEquals(2.0, MapUtils.getDoubleValue(in,"key", 0.0),
> > 0);
> > >>>> +        assertEquals(2.0, MapUtils.getDoubleValue(in,"key"), 0);
> > >>>> +        assertEquals(1.0, MapUtils.getDoubleValue(in,"noKey",
> 1.0),
> > >>>> 0);
> > >>>> +        assertEquals(0, MapUtils.getDoubleValue(in,"noKey"), 0);
> > >>>> +        assertEquals(2.0, MapUtils.getDouble(in,"key", 0.0), 0);
> > >>>> +        assertEquals(1.0, MapUtils.getDouble(in,"noKey", 1.0), 0);
> > >>>>
> > >>>>
> > >>>>           final Map<String, String> inStr = new HashMap<>();
> > >>>> @@ -970,12 +970,12 @@ public class MapUtilsTest extends
> > >>>> AbstractAvailableLocalesTest {
> > >>>>           final Map<String, Float> in = new HashMap<>();
> > >>>>           in.put("key", 2.0f);
> > >>>>
> > >>>> -        assertEquals(MapUtils.getFloatValue(in,"key", 0.0f), 2.0,
> > 0);
> > >>>> -        assertEquals(MapUtils.getFloatValue(in,"key"), 2.0, 0);
> > >>>> -        assertEquals(MapUtils.getFloatValue(in,"noKey", 1.0f),
> 1.0,
> > >>>> 0);
> > >>>> -        assertEquals(MapUtils.getFloatValue(in,"noKey"), 0, 0);
> > >>>> -        assertEquals(MapUtils.getFloat(in,"key", 0.0f), 2.0, 0);
> > >>>> -        assertEquals(MapUtils.getFloat(in,"noKey", 1.0f), 1.0, 0);
> > >>>> +        assertEquals(2.0, MapUtils.getFloatValue(in,"key", 0.0f),
> > 0);
> > >>>> +        assertEquals(2.0, MapUtils.getFloatValue(in,"key"), 0);
> > >>>> +        assertEquals(1.0, MapUtils.getFloatValue(in,"noKey",
> 1.0f),
> > >>>> 0);
> > >>>> +        assertEquals(0, MapUtils.getFloatValue(in,"noKey"), 0);
> > >>>> +        assertEquals(2.0, MapUtils.getFloat(in,"key", 0.0f), 0);
> > >>>> +        assertEquals(1.0, MapUtils.getFloat(in,"noKey", 1.0f), 0);
> > >>>>
> > >>>>           final Map<String, String> inStr = new HashMap<>();
> > >>>>           char decimalSeparator = getDecimalSeparator();
> > >>>> @@ -989,12 +989,12 @@ public class MapUtilsTest extends
> > >>>> AbstractAvailableLocalesTest {
> > >>>>           final Map<String, Long> in = new HashMap<>();
> > >>>>           in.put("key", 2L);
> > >>>>
> > >>>> -        assertEquals(MapUtils.getLongValue(in,"key", 0L), 2.0, 0);
> > >>>> -        assertEquals(MapUtils.getLongValue(in,"key"), 2.0, 0);
> > >>>> -        assertEquals(MapUtils.getLongValue(in,"noKey", 1L), 1, 0);
> > >>>> -        assertEquals(MapUtils.getLongValue(in,"noKey"), 0, 0);
> > >>>> -        assertEquals(MapUtils.getLong(in,"key", 0L), 2.0, 0);
> > >>>> -        assertEquals(MapUtils.getLong(in,"noKey", 1L), 1, 0);
> > >>>> +        assertEquals(2.0, MapUtils.getLongValue(in,"key", 0L), 0);
> > >>>> +        assertEquals(2.0, MapUtils.getLongValue(in,"key"), 0);
> > >>>> +        assertEquals(1, MapUtils.getLongValue(in,"noKey", 1L), 0);
> > >>>> +        assertEquals(0, MapUtils.getLongValue(in,"noKey"), 0);
> > >>>> +        assertEquals(2.0, MapUtils.getLong(in,"key", 0L), 0);
> > >>>> +        assertEquals(1, MapUtils.getLong(in,"noKey", 1L), 0);
> > >>>>
> > >>>>           final Map<String, String> inStr = new HashMap<>();
> > >>>>           inStr.put("str1", "2");
> > >>>> @@ -1009,12 +1009,12 @@ public class MapUtilsTest extends
> > >>>> AbstractAvailableLocalesTest {
> > >>>>           final Map<String, Integer> in = new HashMap<>();
> > >>>>           in.put("key", 2);
> > >>>>
> > >>>> -        assertEquals(MapUtils.getIntValue(in,"key", 0), 2, 0);
> > >>>> -        assertEquals(MapUtils.getIntValue(in,"key"), 2, 0);
> > >>>> -        assertEquals(MapUtils.getIntValue(in,"noKey", 0), 0, 0);
> > >>>> -        assertEquals(MapUtils.getIntValue(in,"noKey"), 0, 0);
> > >>>> -        assertEquals(MapUtils.getInteger(in,"key", 0), 2, 0);
> > >>>> -        assertEquals(MapUtils.getInteger(in,"noKey", 0), 0, 0);
> > >>>> +        assertEquals(2, MapUtils.getIntValue(in,"key", 0), 0);
> > >>>> +        assertEquals(2, MapUtils.getIntValue(in,"key"), 0);
> > >>>> +        assertEquals(0, MapUtils.getIntValue(in,"noKey", 0), 0);
> > >>>> +        assertEquals(0, MapUtils.getIntValue(in,"noKey"), 0);
> > >>>> +        assertEquals(2, MapUtils.getInteger(in,"key", 0), 0);
> > >>>> +        assertEquals(0, MapUtils.getInteger(in,"noKey", 0), 0);
> > >>>>
> > >>>>           final Map<String, String> inStr = new HashMap<>();
> > >>>>           inStr.put("str1", "2");
> > >>>> @@ -1028,12 +1028,12 @@ public class MapUtilsTest extends
> > >>>> AbstractAvailableLocalesTest {
> > >>>>           final short val = 10;
> > >>>>           in.put("key", val);
> > >>>>
> > >>>> -        assertEquals(MapUtils.getShortValue(in,"key", val), val,
> 0);
> > >>>> -        assertEquals(MapUtils.getShortValue(in,"key"), val, 0);
> > >>>> -        assertEquals(MapUtils.getShortValue(in,"noKey", val), val,
> > 0);
> > >>>> -        assertEquals(MapUtils.getShortValue(in,"noKey"), 0, 0);
> > >>>> -        assertEquals(MapUtils.getShort(in,"key", val), val, 0);
> > >>>> -        assertEquals(MapUtils.getShort(in,"noKey", val), val, 0);
> > >>>> +        assertEquals(val, MapUtils.getShortValue(in,"key", val),
> 0);
> > >>>> +        assertEquals(val, MapUtils.getShortValue(in,"key"), 0);
> > >>>> +        assertEquals(val, MapUtils.getShortValue(in,"noKey", val),
> > 0);
> > >>>> +        assertEquals(0, MapUtils.getShortValue(in,"noKey"), 0);
> > >>>> +        assertEquals(val, MapUtils.getShort(in,"key", val), 0);
> > >>>> +        assertEquals(val,MapUtils.getShort(in,"noKey", val), 0);
> > >>>>
> > >>>>           final Map<String, String> inStr = new HashMap<>();
> > >>>>           inStr.put("str1", "10");
> > >>>> @@ -1047,12 +1047,12 @@ public class MapUtilsTest extends
> > >>>> AbstractAvailableLocalesTest {
> > >>>>           final byte val = 100;
> > >>>>           in.put("key", val);
> > >>>>
> > >>>> -        assertEquals(MapUtils.getByteValue(in,"key", val), val,
> 0);
> > >>>> -        assertEquals(MapUtils.getByteValue(in,"key"), val, 0);
> > >>>> -        assertEquals(MapUtils.getByteValue(in,"noKey", val), val,
> > 0);
> > >>>> -        assertEquals(MapUtils.getByteValue(in,"noKey"), 0, 0);
> > >>>> -        assertEquals(MapUtils.getByte(in,"key", val), val, 0);
> > >>>> -        assertEquals(MapUtils.getByte(in,"noKey", val), val, 0);
> > >>>> +        assertEquals(val, MapUtils.getByteValue(in,"key", val),
> 0);
> > >>>> +        assertEquals(val, MapUtils.getByteValue(in,"key"), 0);
> > >>>> +        assertEquals(val, MapUtils.getByteValue(in,"noKey", val),
> > 0);
> > >>>> +        assertEquals(0, MapUtils.getByteValue(in,"noKey"), 0);
> > >>>> +        assertEquals(val, MapUtils.getByte(in,"key", val), 0);
> > >>>> +        assertEquals(val, MapUtils.getByte(in,"noKey", val), 0);
> > >>>>
> > >>>>
> > >>>>           final Map<String, String> inStr = new HashMap<>();
> > >>>> @@ -1067,8 +1067,8 @@ public class MapUtilsTest extends
> > >>>> AbstractAvailableLocalesTest {
> > >>>>           final Number val = 1000;
> > >>>>           in.put("key", val);
> > >>>>
> > >>>> -        assertEquals(MapUtils.getNumber(in,"key", val).intValue(),
> > >>>> val.intValue(), 0);
> > >>>> -        assertEquals(MapUtils.getNumber(in,"noKey",
> val).intValue(),
> > >>>> val.intValue(), 0);
> > >>>> +        assertEquals(val.intValue(), MapUtils.getNumber(in,"key",
> > >>>> val).intValue(), 0);
> > >>>> +        assertEquals(val.intValue(), MapUtils.getNumber(in,"noKey",
> > >>>> val).intValue(), 0);
> > >>>>
> > >>>>       }
> > >>>>
> > >>>> @@ -1077,11 +1077,11 @@ public class MapUtilsTest extends
> > >>>> AbstractAvailableLocalesTest {
> > >>>>           final Map<String, String> in = new HashMap<>();
> > >>>>           in.put("key", "str");
> > >>>>
> > >>>> -        assertEquals(MapUtils.getString(in,"key", "defualt"),
> > "str");
> > >>>> -        assertEquals(MapUtils.getString(in,"key"), "str");
> > >>>> -        assertEquals(MapUtils.getString(null,"key"), null);
> > >>>> -        assertEquals(MapUtils.getString(in,"noKey", "default"),
> > >>>> "default");
> > >>>> -        assertEquals(MapUtils.getString(null,"noKey", "default"),
> > >>>> "default");
> > >>>> +        assertEquals("str", MapUtils.getString(in,"key",
> "defualt"));
> > >>>> +        assertEquals("str", MapUtils.getString(in,"key"));
> > >>>> +        assertEquals(null, MapUtils.getString(null,"key"));
> > >>>> +        assertEquals("default", MapUtils.getString(in,"noKey",
> > >>>> "default"));
> > >>>> +        assertEquals("default", MapUtils.getString(null,"noKey",
> > >>>> "default"));
> > >>>>
> > >>>>       }
> > >>>>
> > >>>> @@ -1090,11 +1090,11 @@ public class MapUtilsTest extends
> > >>>> AbstractAvailableLocalesTest {
> > >>>>           final Map<String, Object> in = new HashMap<>();
> > >>>>           in.put("key", "str");
> > >>>>
> > >>>> -        assertEquals(MapUtils.getObject(in,"key", "defualt"),
> > "str");
> > >>>> -        assertEquals(MapUtils.getObject(in,"key"), "str");
> > >>>> -        assertEquals(MapUtils.getObject(null,"key"), null);
> > >>>> -        assertEquals(MapUtils.getObject(in,"noKey", "default"),
> > >>>> "default");
> > >>>> -        assertEquals(MapUtils.getObject(null,"noKey", "default"),
> > >>>> "default");
> > >>>> +        assertEquals("str", MapUtils.getObject(in,"key",
> "defualt"));
> > >>>> +        assertEquals("str", MapUtils.getObject(in,"key"));
> > >>>> +        assertEquals(null, MapUtils.getObject(null,"key"));
> > >>>> +        assertEquals("default", MapUtils.getObject(in,"noKey",
> > >>>> "default"));
> > >>>> +        assertEquals("default", MapUtils.getObject(null,"noKey",
> > >>>> "default"));
> > >>>>
> > >>>>       }
> > >>>>
> > >>>> @@ -1109,7 +1109,7 @@ public class MapUtilsTest extends
> > >>>> AbstractAvailableLocalesTest {
> > >>>>           assertTrue(!MapUtils.getBooleanValue(in,"noKey"));
> > >>>>           assertTrue(MapUtils.getBoolean(in,"key", true));
> > >>>>           assertTrue(MapUtils.getBoolean(in,"noKey", true));
> > >>>> -        assertEquals(MapUtils.getBoolean(null,"noKey"),null);
> > >>>> +        assertEquals(null, MapUtils.getBoolean(null,"noKey"));
> > >>>>
> > >>>>
> > >>>>
> > >>>> @@ -1130,10 +1130,10 @@ public class MapUtilsTest extends
> > >>>> AbstractAvailableLocalesTest {
> > >>>>           in.put("key1", valMap);
> > >>>>           final Map<?, ?> outValue =  MapUtils.getMap(in,"key1",
> > null);
> > >>>>
> > >>>> -        assertEquals( outValue.get("key1"), "value1");
> > >>>> -        assertEquals( outValue.get("key2"), null);
> > >>>> -        assertEquals( MapUtils.getMap(in,"key2", null), null);
> > >>>> -        assertEquals( MapUtils.getMap(null,"key2", null), null);
> > >>>> +        assertEquals("value1", outValue.get("key1"));
> > >>>> +        assertEquals(null, outValue.get("key2"));
> > >>>> +        assertEquals(null, MapUtils.getMap(in,"key2", null));
> > >>>> +        assertEquals(null, MapUtils.getMap(null,"key2", null));
> > >>>>       }
> > >>>>
> > >>>>       @Test
> > >>>> @@ -1143,8 +1143,8 @@ public class MapUtilsTest extends
> > >>>> AbstractAvailableLocalesTest {
> > >>>>
> > >>>>           MapUtils.safeAddToMap(inMap,"key1", "value1");
> > >>>>           MapUtils.safeAddToMap(inMap,"key2", null);
> > >>>> -        assertEquals( inMap.get("key1"), "value1");
> > >>>> -        assertEquals( inMap.get("key2"), "");
> > >>>> +        assertEquals("value1", inMap.get("key1"));
> > >>>> +        assertEquals("", inMap.get("key2"));
> > >>>>       }
> > >>>>
> > >>>>       @Test
> > >>>>
> > >>>>
> > >>>>
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [hidden email]
> > > For additional commands, e-mail: [hidden email]
> > >
> > >
> >
>
>
>
> --
> Matt Sicker <[hidden email]>
>
Reply | Threaded
Open this post in threaded view
|

Re: commons-collections git commit: MapUtilsTest: fix order of expected and actual parameter in assertions (closes #32)

garydgregory
Darn, I meant TestNG.

Gary

On Sat, Oct 14, 2017 at 12:58 PM, Gary Gregory <[hidden email]>
wrote:

> How does it compare to RelaxNG?
>
> G
>
> On Sat, Oct 14, 2017 at 12:49 PM, Matt Sicker <[hidden email]> wrote:
>
>> AssertJ is an assertion library and works with JUnit or whatever testing
>> framework you want. Essentially, it's a replacement for Hamcrest +
>> org.junit.Assert.
>>
>> On 14 October 2017 at 13:27, Gary Gregory <[hidden email]> wrote:
>>
>> > I have no interest in switching from JUnit, especially with JUnit 5
>> around
>> > the corner.
>> >
>> > Gary
>> >
>> > On Sat, Oct 14, 2017 at 12:25 PM, Pascal Schumacher <
>> > [hidden email]> wrote:
>> >
>> > > Any time. :-)
>> > >
>> > > Migrating is not hard, as there are scripts to do most of the work,
>> see:
>> > >
>> > > https://joel-costigliola.github.io/assertj/assertj-core-
>> > > converting-junit-assertions-to-assertj.html
>> > >
>> > > Am 14.10.2017 um 19:06 schrieb Benedikt Ritter:
>> > >
>> > >> About time we migrate to AssertJ. :-)
>> > >>
>> > >> Gary Gregory <[hidden email]> schrieb am Sa. 14. Okt. 2017
>> um
>> > >> 18:55:
>> > >>
>> > >> Thank you for doing that! That was driving me nuts!
>> > >>>
>> > >>> Gary
>> > >>>
>> > >>> On Oct 14, 2017 10:53, <[hidden email]> wrote:
>> > >>>
>> > >>> Repository: commons-collections
>> > >>>> Updated Branches:
>> > >>>>    refs/heads/master 641aa1c66 -> b9522976f
>> > >>>>
>> > >>>>
>> > >>>> MapUtilsTest: fix order of expected and actual parameter in
>> assertions
>> > >>>> (closes #32)
>> > >>>>
>> > >>>>
>> > >>>> Project: http://git-wip-us.apache.org/r
>> epos/asf/commons-collections/r
>> > >>>> epo
>> > >>>> Commit: http://git-wip-us.apache.org/r
>> epos/asf/commons-collections/
>> > >>>> commit/b9522976
>> > >>>> Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/
>> > >>>> tree/b9522976
>> > >>>> Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/
>> > >>>> diff/b9522976
>> > >>>>
>> > >>>> Branch: refs/heads/master
>> > >>>> Commit: b9522976f462687b0693b7229ba5c7faee0cb74b
>> > >>>> Parents: 641aa1c
>> > >>>> Author: Kavuri, Vamsi <[hidden email]>
>> > >>>> Authored: Sat Oct 14 12:30:35 2017 -0400
>> > >>>> Committer: pascalschumacher <[hidden email]>
>> > >>>> Committed: Sat Oct 14 18:52:04 2017 +0200
>> > >>>>
>> > >>>> ------------------------------------------------------------
>> > ----------
>> > >>>>   .../commons/collections4/MapUtilsTest.java      | 110
>> > >>>>
>> > >>> +++++++++----------
>> > >>>
>> > >>>>   1 file changed, 55 insertions(+), 55 deletions(-)
>> > >>>> ------------------------------------------------------------
>> > ----------
>> > >>>>
>> > >>>>
>> > >>>> http://git-wip-us.apache.org/repos/asf/commons-collections/
>> > >>>> blob/b9522976/src/test/java/org/apache/commons/
>> > >>>> collections4/MapUtilsTest.java
>> > >>>> ------------------------------------------------------------
>> > ----------
>> > >>>> diff --git
>> > >>>>
>> > >>> a/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
>> > >>>
>> > >>>> b/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
>> > >>>> index fc3e3d6..21f20c4 100644
>> > >>>> --- a/src/test/java/org/apache/commons/collections4/MapUtilsTest
>> .java
>> > >>>> +++ b/src/test/java/org/apache/commons/collections4/MapUtilsTest
>> .java
>> > >>>> @@ -950,12 +950,12 @@ public class MapUtilsTest extends
>> > >>>> AbstractAvailableLocalesTest {
>> > >>>>           final Map<String, Double> in = new HashMap<>();
>> > >>>>           in.put("key", 2.0);
>> > >>>>
>> > >>>> -        assertEquals(MapUtils.getDoubleValue(in,"key", 0.0), 2.0,
>> > 0);
>> > >>>> -        assertEquals(MapUtils.getDoubleValue(in,"key"), 2.0, 0);
>> > >>>> -        assertEquals(MapUtils.getDoubleValue(in,"noKey", 1.0),
>> 1.0,
>> > >>>> 0);
>> > >>>> -        assertEquals(MapUtils.getDoubleValue(in,"noKey"), 0, 0);
>> > >>>> -        assertEquals(MapUtils.getDouble(in,"key", 0.0), 2.0, 0);
>> > >>>> -        assertEquals(MapUtils.getDouble(in,"noKey", 1.0), 1.0,
>> 0);
>> > >>>> +        assertEquals(2.0, MapUtils.getDoubleValue(in,"key", 0.0),
>> > 0);
>> > >>>> +        assertEquals(2.0, MapUtils.getDoubleValue(in,"key"), 0);
>> > >>>> +        assertEquals(1.0, MapUtils.getDoubleValue(in,"noKey",
>> 1.0),
>> > >>>> 0);
>> > >>>> +        assertEquals(0, MapUtils.getDoubleValue(in,"noKey"), 0);
>> > >>>> +        assertEquals(2.0, MapUtils.getDouble(in,"key", 0.0), 0);
>> > >>>> +        assertEquals(1.0, MapUtils.getDouble(in,"noKey", 1.0), 0);
>> > >>>>
>> > >>>>
>> > >>>>           final Map<String, String> inStr = new HashMap<>();
>> > >>>> @@ -970,12 +970,12 @@ public class MapUtilsTest extends
>> > >>>> AbstractAvailableLocalesTest {
>> > >>>>           final Map<String, Float> in = new HashMap<>();
>> > >>>>           in.put("key", 2.0f);
>> > >>>>
>> > >>>> -        assertEquals(MapUtils.getFloatValue(in,"key", 0.0f), 2.0,
>> > 0);
>> > >>>> -        assertEquals(MapUtils.getFloatValue(in,"key"), 2.0, 0);
>> > >>>> -        assertEquals(MapUtils.getFloatValue(in,"noKey", 1.0f),
>> 1.0,
>> > >>>> 0);
>> > >>>> -        assertEquals(MapUtils.getFloatValue(in,"noKey"), 0, 0);
>> > >>>> -        assertEquals(MapUtils.getFloat(in,"key", 0.0f), 2.0, 0);
>> > >>>> -        assertEquals(MapUtils.getFloat(in,"noKey", 1.0f), 1.0,
>> 0);
>> > >>>> +        assertEquals(2.0, MapUtils.getFloatValue(in,"key", 0.0f),
>> > 0);
>> > >>>> +        assertEquals(2.0, MapUtils.getFloatValue(in,"key"), 0);
>> > >>>> +        assertEquals(1.0, MapUtils.getFloatValue(in,"noKey",
>> 1.0f),
>> > >>>> 0);
>> > >>>> +        assertEquals(0, MapUtils.getFloatValue(in,"noKey"), 0);
>> > >>>> +        assertEquals(2.0, MapUtils.getFloat(in,"key", 0.0f), 0);
>> > >>>> +        assertEquals(1.0, MapUtils.getFloat(in,"noKey", 1.0f), 0);
>> > >>>>
>> > >>>>           final Map<String, String> inStr = new HashMap<>();
>> > >>>>           char decimalSeparator = getDecimalSeparator();
>> > >>>> @@ -989,12 +989,12 @@ public class MapUtilsTest extends
>> > >>>> AbstractAvailableLocalesTest {
>> > >>>>           final Map<String, Long> in = new HashMap<>();
>> > >>>>           in.put("key", 2L);
>> > >>>>
>> > >>>> -        assertEquals(MapUtils.getLongValue(in,"key", 0L), 2.0,
>> 0);
>> > >>>> -        assertEquals(MapUtils.getLongValue(in,"key"), 2.0, 0);
>> > >>>> -        assertEquals(MapUtils.getLongValue(in,"noKey", 1L), 1,
>> 0);
>> > >>>> -        assertEquals(MapUtils.getLongValue(in,"noKey"), 0, 0);
>> > >>>> -        assertEquals(MapUtils.getLong(in,"key", 0L), 2.0, 0);
>> > >>>> -        assertEquals(MapUtils.getLong(in,"noKey", 1L), 1, 0);
>> > >>>> +        assertEquals(2.0, MapUtils.getLongValue(in,"key", 0L),
>> 0);
>> > >>>> +        assertEquals(2.0, MapUtils.getLongValue(in,"key"), 0);
>> > >>>> +        assertEquals(1, MapUtils.getLongValue(in,"noKey", 1L),
>> 0);
>> > >>>> +        assertEquals(0, MapUtils.getLongValue(in,"noKey"), 0);
>> > >>>> +        assertEquals(2.0, MapUtils.getLong(in,"key", 0L), 0);
>> > >>>> +        assertEquals(1, MapUtils.getLong(in,"noKey", 1L), 0);
>> > >>>>
>> > >>>>           final Map<String, String> inStr = new HashMap<>();
>> > >>>>           inStr.put("str1", "2");
>> > >>>> @@ -1009,12 +1009,12 @@ public class MapUtilsTest extends
>> > >>>> AbstractAvailableLocalesTest {
>> > >>>>           final Map<String, Integer> in = new HashMap<>();
>> > >>>>           in.put("key", 2);
>> > >>>>
>> > >>>> -        assertEquals(MapUtils.getIntValue(in,"key", 0), 2, 0);
>> > >>>> -        assertEquals(MapUtils.getIntValue(in,"key"), 2, 0);
>> > >>>> -        assertEquals(MapUtils.getIntValue(in,"noKey", 0), 0, 0);
>> > >>>> -        assertEquals(MapUtils.getIntValue(in,"noKey"), 0, 0);
>> > >>>> -        assertEquals(MapUtils.getInteger(in,"key", 0), 2, 0);
>> > >>>> -        assertEquals(MapUtils.getInteger(in,"noKey", 0), 0, 0);
>> > >>>> +        assertEquals(2, MapUtils.getIntValue(in,"key", 0), 0);
>> > >>>> +        assertEquals(2, MapUtils.getIntValue(in,"key"), 0);
>> > >>>> +        assertEquals(0, MapUtils.getIntValue(in,"noKey", 0), 0);
>> > >>>> +        assertEquals(0, MapUtils.getIntValue(in,"noKey"), 0);
>> > >>>> +        assertEquals(2, MapUtils.getInteger(in,"key", 0), 0);
>> > >>>> +        assertEquals(0, MapUtils.getInteger(in,"noKey", 0), 0);
>> > >>>>
>> > >>>>           final Map<String, String> inStr = new HashMap<>();
>> > >>>>           inStr.put("str1", "2");
>> > >>>> @@ -1028,12 +1028,12 @@ public class MapUtilsTest extends
>> > >>>> AbstractAvailableLocalesTest {
>> > >>>>           final short val = 10;
>> > >>>>           in.put("key", val);
>> > >>>>
>> > >>>> -        assertEquals(MapUtils.getShortValue(in,"key", val), val,
>> 0);
>> > >>>> -        assertEquals(MapUtils.getShortValue(in,"key"), val, 0);
>> > >>>> -        assertEquals(MapUtils.getShortValue(in,"noKey", val),
>> val,
>> > 0);
>> > >>>> -        assertEquals(MapUtils.getShortValue(in,"noKey"), 0, 0);
>> > >>>> -        assertEquals(MapUtils.getShort(in,"key", val), val, 0);
>> > >>>> -        assertEquals(MapUtils.getShort(in,"noKey", val), val, 0);
>> > >>>> +        assertEquals(val, MapUtils.getShortValue(in,"key", val),
>> 0);
>> > >>>> +        assertEquals(val, MapUtils.getShortValue(in,"key"), 0);
>> > >>>> +        assertEquals(val, MapUtils.getShortValue(in,"noKey",
>> val),
>> > 0);
>> > >>>> +        assertEquals(0, MapUtils.getShortValue(in,"noKey"), 0);
>> > >>>> +        assertEquals(val, MapUtils.getShort(in,"key", val), 0);
>> > >>>> +        assertEquals(val,MapUtils.getShort(in,"noKey", val), 0);
>> > >>>>
>> > >>>>           final Map<String, String> inStr = new HashMap<>();
>> > >>>>           inStr.put("str1", "10");
>> > >>>> @@ -1047,12 +1047,12 @@ public class MapUtilsTest extends
>> > >>>> AbstractAvailableLocalesTest {
>> > >>>>           final byte val = 100;
>> > >>>>           in.put("key", val);
>> > >>>>
>> > >>>> -        assertEquals(MapUtils.getByteValue(in,"key", val), val,
>> 0);
>> > >>>> -        assertEquals(MapUtils.getByteValue(in,"key"), val, 0);
>> > >>>> -        assertEquals(MapUtils.getByteValue(in,"noKey", val), val,
>> > 0);
>> > >>>> -        assertEquals(MapUtils.getByteValue(in,"noKey"), 0, 0);
>> > >>>> -        assertEquals(MapUtils.getByte(in,"key", val), val, 0);
>> > >>>> -        assertEquals(MapUtils.getByte(in,"noKey", val), val, 0);
>> > >>>> +        assertEquals(val, MapUtils.getByteValue(in,"key", val),
>> 0);
>> > >>>> +        assertEquals(val, MapUtils.getByteValue(in,"key"), 0);
>> > >>>> +        assertEquals(val, MapUtils.getByteValue(in,"noKey", val),
>> > 0);
>> > >>>> +        assertEquals(0, MapUtils.getByteValue(in,"noKey"), 0);
>> > >>>> +        assertEquals(val, MapUtils.getByte(in,"key", val), 0);
>> > >>>> +        assertEquals(val, MapUtils.getByte(in,"noKey", val), 0);
>> > >>>>
>> > >>>>
>> > >>>>           final Map<String, String> inStr = new HashMap<>();
>> > >>>> @@ -1067,8 +1067,8 @@ public class MapUtilsTest extends
>> > >>>> AbstractAvailableLocalesTest {
>> > >>>>           final Number val = 1000;
>> > >>>>           in.put("key", val);
>> > >>>>
>> > >>>> -        assertEquals(MapUtils.getNumber(in,"key",
>> val).intValue(),
>> > >>>> val.intValue(), 0);
>> > >>>> -        assertEquals(MapUtils.getNumber(in,"noKey",
>> val).intValue(),
>> > >>>> val.intValue(), 0);
>> > >>>> +        assertEquals(val.intValue(), MapUtils.getNumber(in,"key",
>> > >>>> val).intValue(), 0);
>> > >>>> +        assertEquals(val.intValue(),
>> MapUtils.getNumber(in,"noKey",
>> > >>>> val).intValue(), 0);
>> > >>>>
>> > >>>>       }
>> > >>>>
>> > >>>> @@ -1077,11 +1077,11 @@ public class MapUtilsTest extends
>> > >>>> AbstractAvailableLocalesTest {
>> > >>>>           final Map<String, String> in = new HashMap<>();
>> > >>>>           in.put("key", "str");
>> > >>>>
>> > >>>> -        assertEquals(MapUtils.getString(in,"key", "defualt"),
>> > "str");
>> > >>>> -        assertEquals(MapUtils.getString(in,"key"), "str");
>> > >>>> -        assertEquals(MapUtils.getString(null,"key"), null);
>> > >>>> -        assertEquals(MapUtils.getString(in,"noKey", "default"),
>> > >>>> "default");
>> > >>>> -        assertEquals(MapUtils.getString(null,"noKey", "default"),
>> > >>>> "default");
>> > >>>> +        assertEquals("str", MapUtils.getString(in,"key",
>> "defualt"));
>> > >>>> +        assertEquals("str", MapUtils.getString(in,"key"));
>> > >>>> +        assertEquals(null, MapUtils.getString(null,"key"));
>> > >>>> +        assertEquals("default", MapUtils.getString(in,"noKey",
>> > >>>> "default"));
>> > >>>> +        assertEquals("default", MapUtils.getString(null,"noKey",
>> > >>>> "default"));
>> > >>>>
>> > >>>>       }
>> > >>>>
>> > >>>> @@ -1090,11 +1090,11 @@ public class MapUtilsTest extends
>> > >>>> AbstractAvailableLocalesTest {
>> > >>>>           final Map<String, Object> in = new HashMap<>();
>> > >>>>           in.put("key", "str");
>> > >>>>
>> > >>>> -        assertEquals(MapUtils.getObject(in,"key", "defualt"),
>> > "str");
>> > >>>> -        assertEquals(MapUtils.getObject(in,"key"), "str");
>> > >>>> -        assertEquals(MapUtils.getObject(null,"key"), null);
>> > >>>> -        assertEquals(MapUtils.getObject(in,"noKey", "default"),
>> > >>>> "default");
>> > >>>> -        assertEquals(MapUtils.getObject(null,"noKey", "default"),
>> > >>>> "default");
>> > >>>> +        assertEquals("str", MapUtils.getObject(in,"key",
>> "defualt"));
>> > >>>> +        assertEquals("str", MapUtils.getObject(in,"key"));
>> > >>>> +        assertEquals(null, MapUtils.getObject(null,"key"));
>> > >>>> +        assertEquals("default", MapUtils.getObject(in,"noKey",
>> > >>>> "default"));
>> > >>>> +        assertEquals("default", MapUtils.getObject(null,"noKey",
>> > >>>> "default"));
>> > >>>>
>> > >>>>       }
>> > >>>>
>> > >>>> @@ -1109,7 +1109,7 @@ public class MapUtilsTest extends
>> > >>>> AbstractAvailableLocalesTest {
>> > >>>>           assertTrue(!MapUtils.getBooleanValue(in,"noKey"));
>> > >>>>           assertTrue(MapUtils.getBoolean(in,"key", true));
>> > >>>>           assertTrue(MapUtils.getBoolean(in,"noKey", true));
>> > >>>> -        assertEquals(MapUtils.getBoolean(null,"noKey"),null);
>> > >>>> +        assertEquals(null, MapUtils.getBoolean(null,"noKey"));
>> > >>>>
>> > >>>>
>> > >>>>
>> > >>>> @@ -1130,10 +1130,10 @@ public class MapUtilsTest extends
>> > >>>> AbstractAvailableLocalesTest {
>> > >>>>           in.put("key1", valMap);
>> > >>>>           final Map<?, ?> outValue =  MapUtils.getMap(in,"key1",
>> > null);
>> > >>>>
>> > >>>> -        assertEquals( outValue.get("key1"), "value1");
>> > >>>> -        assertEquals( outValue.get("key2"), null);
>> > >>>> -        assertEquals( MapUtils.getMap(in,"key2", null), null);
>> > >>>> -        assertEquals( MapUtils.getMap(null,"key2", null), null);
>> > >>>> +        assertEquals("value1", outValue.get("key1"));
>> > >>>> +        assertEquals(null, outValue.get("key2"));
>> > >>>> +        assertEquals(null, MapUtils.getMap(in,"key2", null));
>> > >>>> +        assertEquals(null, MapUtils.getMap(null,"key2", null));
>> > >>>>       }
>> > >>>>
>> > >>>>       @Test
>> > >>>> @@ -1143,8 +1143,8 @@ public class MapUtilsTest extends
>> > >>>> AbstractAvailableLocalesTest {
>> > >>>>
>> > >>>>           MapUtils.safeAddToMap(inMap,"key1", "value1");
>> > >>>>           MapUtils.safeAddToMap(inMap,"key2", null);
>> > >>>> -        assertEquals( inMap.get("key1"), "value1");
>> > >>>> -        assertEquals( inMap.get("key2"), "");
>> > >>>> +        assertEquals("value1", inMap.get("key1"));
>> > >>>> +        assertEquals("", inMap.get("key2"));
>> > >>>>       }
>> > >>>>
>> > >>>>       @Test
>> > >>>>
>> > >>>>
>> > >>>>
>> > >
>> > > ---------------------------------------------------------------------
>> > > To unsubscribe, e-mail: [hidden email]
>> > > For additional commands, e-mail: [hidden email]
>> > >
>> > >
>> >
>>
>>
>>
>> --
>> Matt Sicker <[hidden email]>
>>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: commons-collections git commit: MapUtilsTest: fix order of expected and actual parameter in assertions (closes #32)

Pascal Schumacher
As mentioned by Matt, assertj focuses on providing assertions. Readable,
fluent assertions and helpful error messages.

It's basically as if Hamcrest added a fluent interface (so available
assertions are easy to discover) and continued development at full speed
after releasing 1.3, adding many additional matchers.

Some AssertJ examples copied from
https://joel-costigliola.github.io/assertj/

|// basic assertions assertThat(frodo.getName()).isEqualTo("Frodo");
assertThat(frodo).isNotEqualTo(sauron); // chaining string specific
assertions assertThat(frodo.getName()).startsWith("Fro") .endsWith("do")
.isEqualToIgnoringCase("frodo"); // collection specific assertions
(there are plenty more) // in the examples below fellowshipOfTheRing is
a List<TolkienCharacter
<https://github.com/joel-costigliola/assertj-examples/blob/java-8/assertions-examples/src/main/java/org/assertj/examples/data/TolkienCharacter.java>>
assertThat(fellowshipOfTheRing).hasSize(9) .contains(frodo, sam)
.doesNotContain(sauron);|


Am 14.10.2017 um 20:58 schrieb Gary Gregory:

> Darn, I meant TestNG.
>
> Gary
>
> On Sat, Oct 14, 2017 at 12:58 PM, Gary Gregory <[hidden email]>
> wrote:
>
>> How does it compare to RelaxNG?
>>
>> G
>>
>> On Sat, Oct 14, 2017 at 12:49 PM, Matt Sicker <[hidden email]> wrote:
>>
>>> AssertJ is an assertion library and works with JUnit or whatever testing
>>> framework you want. Essentially, it's a replacement for Hamcrest +
>>> org.junit.Assert.
>>>
>>> On 14 October 2017 at 13:27, Gary Gregory <[hidden email]> wrote:
>>>
>>>> I have no interest in switching from JUnit, especially with JUnit 5
>>> around
>>>> the corner.
>>>>
>>>> Gary
>>>>
>>>> On Sat, Oct 14, 2017 at 12:25 PM, Pascal Schumacher <
>>>> [hidden email]> wrote:
>>>>
>>>>> Any time. :-)
>>>>>
>>>>> Migrating is not hard, as there are scripts to do most of the work,
>>> see:
>>>>> https://joel-costigliola.github.io/assertj/assertj-core-
>>>>> converting-junit-assertions-to-assertj.html
>>>>>
>>>>> Am 14.10.2017 um 19:06 schrieb Benedikt Ritter:
>>>>>
>>>>>> About time we migrate to AssertJ. :-)
>>>>>>
>>>>>> Gary Gregory <[hidden email]> schrieb am Sa. 14. Okt. 2017
>>> um
>>>>>> 18:55:
>>>>>>
>>>>>> Thank you for doing that! That was driving me nuts!
>>>>>>> Gary
>>>>>>>
>>>>>>> On Oct 14, 2017 10:53, <[hidden email]> wrote:
>>>>>>>
>>>>>>> Repository: commons-collections
>>>>>>>> Updated Branches:
>>>>>>>>     refs/heads/master 641aa1c66 -> b9522976f
>>>>>>>>
>>>>>>>>
>>>>>>>> MapUtilsTest: fix order of expected and actual parameter in
>>> assertions
>>>>>>>> (closes #32)
>>>>>>>>
>>>>>>>>
>>>>>>>> Project: http://git-wip-us.apache.org/r
>>> epos/asf/commons-collections/r
>>>>>>>> epo
>>>>>>>> Commit: http://git-wip-us.apache.org/r
>>> epos/asf/commons-collections/
>>>>>>>> commit/b9522976
>>>>>>>> Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/
>>>>>>>> tree/b9522976
>>>>>>>> Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/
>>>>>>>> diff/b9522976
>>>>>>>>
>>>>>>>> Branch: refs/heads/master
>>>>>>>> Commit: b9522976f462687b0693b7229ba5c7faee0cb74b
>>>>>>>> Parents: 641aa1c
>>>>>>>> Author: Kavuri, Vamsi <[hidden email]>
>>>>>>>> Authored: Sat Oct 14 12:30:35 2017 -0400
>>>>>>>> Committer: pascalschumacher <[hidden email]>
>>>>>>>> Committed: Sat Oct 14 18:52:04 2017 +0200
>>>>>>>>
>>>>>>>> ------------------------------------------------------------
>>>> ----------
>>>>>>>>    .../commons/collections4/MapUtilsTest.java      | 110
>>>>>>>>
>>>>>>> +++++++++----------
>>>>>>>
>>>>>>>>    1 file changed, 55 insertions(+), 55 deletions(-)
>>>>>>>> ------------------------------------------------------------
>>>> ----------
>>>>>>>>
>>>>>>>> http://git-wip-us.apache.org/repos/asf/commons-collections/
>>>>>>>> blob/b9522976/src/test/java/org/apache/commons/
>>>>>>>> collections4/MapUtilsTest.java
>>>>>>>> ------------------------------------------------------------
>>>> ----------
>>>>>>>> diff --git
>>>>>>>>
>>>>>>> a/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
>>>>>>>
>>>>>>>> b/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
>>>>>>>> index fc3e3d6..21f20c4 100644
>>>>>>>> --- a/src/test/java/org/apache/commons/collections4/MapUtilsTest
>>> .java
>>>>>>>> +++ b/src/test/java/org/apache/commons/collections4/MapUtilsTest
>>> .java
>>>>>>>> @@ -950,12 +950,12 @@ public class MapUtilsTest extends
>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>            final Map<String, Double> in = new HashMap<>();
>>>>>>>>            in.put("key", 2.0);
>>>>>>>>
>>>>>>>> -        assertEquals(MapUtils.getDoubleValue(in,"key", 0.0), 2.0,
>>>> 0);
>>>>>>>> -        assertEquals(MapUtils.getDoubleValue(in,"key"), 2.0, 0);
>>>>>>>> -        assertEquals(MapUtils.getDoubleValue(in,"noKey", 1.0),
>>> 1.0,
>>>>>>>> 0);
>>>>>>>> -        assertEquals(MapUtils.getDoubleValue(in,"noKey"), 0, 0);
>>>>>>>> -        assertEquals(MapUtils.getDouble(in,"key", 0.0), 2.0, 0);
>>>>>>>> -        assertEquals(MapUtils.getDouble(in,"noKey", 1.0), 1.0,
>>> 0);
>>>>>>>> +        assertEquals(2.0, MapUtils.getDoubleValue(in,"key", 0.0),
>>>> 0);
>>>>>>>> +        assertEquals(2.0, MapUtils.getDoubleValue(in,"key"), 0);
>>>>>>>> +        assertEquals(1.0, MapUtils.getDoubleValue(in,"noKey",
>>> 1.0),
>>>>>>>> 0);
>>>>>>>> +        assertEquals(0, MapUtils.getDoubleValue(in,"noKey"), 0);
>>>>>>>> +        assertEquals(2.0, MapUtils.getDouble(in,"key", 0.0), 0);
>>>>>>>> +        assertEquals(1.0, MapUtils.getDouble(in,"noKey", 1.0), 0);
>>>>>>>>
>>>>>>>>
>>>>>>>>            final Map<String, String> inStr = new HashMap<>();
>>>>>>>> @@ -970,12 +970,12 @@ public class MapUtilsTest extends
>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>            final Map<String, Float> in = new HashMap<>();
>>>>>>>>            in.put("key", 2.0f);
>>>>>>>>
>>>>>>>> -        assertEquals(MapUtils.getFloatValue(in,"key", 0.0f), 2.0,
>>>> 0);
>>>>>>>> -        assertEquals(MapUtils.getFloatValue(in,"key"), 2.0, 0);
>>>>>>>> -        assertEquals(MapUtils.getFloatValue(in,"noKey", 1.0f),
>>> 1.0,
>>>>>>>> 0);
>>>>>>>> -        assertEquals(MapUtils.getFloatValue(in,"noKey"), 0, 0);
>>>>>>>> -        assertEquals(MapUtils.getFloat(in,"key", 0.0f), 2.0, 0);
>>>>>>>> -        assertEquals(MapUtils.getFloat(in,"noKey", 1.0f), 1.0,
>>> 0);
>>>>>>>> +        assertEquals(2.0, MapUtils.getFloatValue(in,"key", 0.0f),
>>>> 0);
>>>>>>>> +        assertEquals(2.0, MapUtils.getFloatValue(in,"key"), 0);
>>>>>>>> +        assertEquals(1.0, MapUtils.getFloatValue(in,"noKey",
>>> 1.0f),
>>>>>>>> 0);
>>>>>>>> +        assertEquals(0, MapUtils.getFloatValue(in,"noKey"), 0);
>>>>>>>> +        assertEquals(2.0, MapUtils.getFloat(in,"key", 0.0f), 0);
>>>>>>>> +        assertEquals(1.0, MapUtils.getFloat(in,"noKey", 1.0f), 0);
>>>>>>>>
>>>>>>>>            final Map<String, String> inStr = new HashMap<>();
>>>>>>>>            char decimalSeparator = getDecimalSeparator();
>>>>>>>> @@ -989,12 +989,12 @@ public class MapUtilsTest extends
>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>            final Map<String, Long> in = new HashMap<>();
>>>>>>>>            in.put("key", 2L);
>>>>>>>>
>>>>>>>> -        assertEquals(MapUtils.getLongValue(in,"key", 0L), 2.0,
>>> 0);
>>>>>>>> -        assertEquals(MapUtils.getLongValue(in,"key"), 2.0, 0);
>>>>>>>> -        assertEquals(MapUtils.getLongValue(in,"noKey", 1L), 1,
>>> 0);
>>>>>>>> -        assertEquals(MapUtils.getLongValue(in,"noKey"), 0, 0);
>>>>>>>> -        assertEquals(MapUtils.getLong(in,"key", 0L), 2.0, 0);
>>>>>>>> -        assertEquals(MapUtils.getLong(in,"noKey", 1L), 1, 0);
>>>>>>>> +        assertEquals(2.0, MapUtils.getLongValue(in,"key", 0L),
>>> 0);
>>>>>>>> +        assertEquals(2.0, MapUtils.getLongValue(in,"key"), 0);
>>>>>>>> +        assertEquals(1, MapUtils.getLongValue(in,"noKey", 1L),
>>> 0);
>>>>>>>> +        assertEquals(0, MapUtils.getLongValue(in,"noKey"), 0);
>>>>>>>> +        assertEquals(2.0, MapUtils.getLong(in,"key", 0L), 0);
>>>>>>>> +        assertEquals(1, MapUtils.getLong(in,"noKey", 1L), 0);
>>>>>>>>
>>>>>>>>            final Map<String, String> inStr = new HashMap<>();
>>>>>>>>            inStr.put("str1", "2");
>>>>>>>> @@ -1009,12 +1009,12 @@ public class MapUtilsTest extends
>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>            final Map<String, Integer> in = new HashMap<>();
>>>>>>>>            in.put("key", 2);
>>>>>>>>
>>>>>>>> -        assertEquals(MapUtils.getIntValue(in,"key", 0), 2, 0);
>>>>>>>> -        assertEquals(MapUtils.getIntValue(in,"key"), 2, 0);
>>>>>>>> -        assertEquals(MapUtils.getIntValue(in,"noKey", 0), 0, 0);
>>>>>>>> -        assertEquals(MapUtils.getIntValue(in,"noKey"), 0, 0);
>>>>>>>> -        assertEquals(MapUtils.getInteger(in,"key", 0), 2, 0);
>>>>>>>> -        assertEquals(MapUtils.getInteger(in,"noKey", 0), 0, 0);
>>>>>>>> +        assertEquals(2, MapUtils.getIntValue(in,"key", 0), 0);
>>>>>>>> +        assertEquals(2, MapUtils.getIntValue(in,"key"), 0);
>>>>>>>> +        assertEquals(0, MapUtils.getIntValue(in,"noKey", 0), 0);
>>>>>>>> +        assertEquals(0, MapUtils.getIntValue(in,"noKey"), 0);
>>>>>>>> +        assertEquals(2, MapUtils.getInteger(in,"key", 0), 0);
>>>>>>>> +        assertEquals(0, MapUtils.getInteger(in,"noKey", 0), 0);
>>>>>>>>
>>>>>>>>            final Map<String, String> inStr = new HashMap<>();
>>>>>>>>            inStr.put("str1", "2");
>>>>>>>> @@ -1028,12 +1028,12 @@ public class MapUtilsTest extends
>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>            final short val = 10;
>>>>>>>>            in.put("key", val);
>>>>>>>>
>>>>>>>> -        assertEquals(MapUtils.getShortValue(in,"key", val), val,
>>> 0);
>>>>>>>> -        assertEquals(MapUtils.getShortValue(in,"key"), val, 0);
>>>>>>>> -        assertEquals(MapUtils.getShortValue(in,"noKey", val),
>>> val,
>>>> 0);
>>>>>>>> -        assertEquals(MapUtils.getShortValue(in,"noKey"), 0, 0);
>>>>>>>> -        assertEquals(MapUtils.getShort(in,"key", val), val, 0);
>>>>>>>> -        assertEquals(MapUtils.getShort(in,"noKey", val), val, 0);
>>>>>>>> +        assertEquals(val, MapUtils.getShortValue(in,"key", val),
>>> 0);
>>>>>>>> +        assertEquals(val, MapUtils.getShortValue(in,"key"), 0);
>>>>>>>> +        assertEquals(val, MapUtils.getShortValue(in,"noKey",
>>> val),
>>>> 0);
>>>>>>>> +        assertEquals(0, MapUtils.getShortValue(in,"noKey"), 0);
>>>>>>>> +        assertEquals(val, MapUtils.getShort(in,"key", val), 0);
>>>>>>>> +        assertEquals(val,MapUtils.getShort(in,"noKey", val), 0);
>>>>>>>>
>>>>>>>>            final Map<String, String> inStr = new HashMap<>();
>>>>>>>>            inStr.put("str1", "10");
>>>>>>>> @@ -1047,12 +1047,12 @@ public class MapUtilsTest extends
>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>            final byte val = 100;
>>>>>>>>            in.put("key", val);
>>>>>>>>
>>>>>>>> -        assertEquals(MapUtils.getByteValue(in,"key", val), val,
>>> 0);
>>>>>>>> -        assertEquals(MapUtils.getByteValue(in,"key"), val, 0);
>>>>>>>> -        assertEquals(MapUtils.getByteValue(in,"noKey", val), val,
>>>> 0);
>>>>>>>> -        assertEquals(MapUtils.getByteValue(in,"noKey"), 0, 0);
>>>>>>>> -        assertEquals(MapUtils.getByte(in,"key", val), val, 0);
>>>>>>>> -        assertEquals(MapUtils.getByte(in,"noKey", val), val, 0);
>>>>>>>> +        assertEquals(val, MapUtils.getByteValue(in,"key", val),
>>> 0);
>>>>>>>> +        assertEquals(val, MapUtils.getByteValue(in,"key"), 0);
>>>>>>>> +        assertEquals(val, MapUtils.getByteValue(in,"noKey", val),
>>>> 0);
>>>>>>>> +        assertEquals(0, MapUtils.getByteValue(in,"noKey"), 0);
>>>>>>>> +        assertEquals(val, MapUtils.getByte(in,"key", val), 0);
>>>>>>>> +        assertEquals(val, MapUtils.getByte(in,"noKey", val), 0);
>>>>>>>>
>>>>>>>>
>>>>>>>>            final Map<String, String> inStr = new HashMap<>();
>>>>>>>> @@ -1067,8 +1067,8 @@ public class MapUtilsTest extends
>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>            final Number val = 1000;
>>>>>>>>            in.put("key", val);
>>>>>>>>
>>>>>>>> -        assertEquals(MapUtils.getNumber(in,"key",
>>> val).intValue(),
>>>>>>>> val.intValue(), 0);
>>>>>>>> -        assertEquals(MapUtils.getNumber(in,"noKey",
>>> val).intValue(),
>>>>>>>> val.intValue(), 0);
>>>>>>>> +        assertEquals(val.intValue(), MapUtils.getNumber(in,"key",
>>>>>>>> val).intValue(), 0);
>>>>>>>> +        assertEquals(val.intValue(),
>>> MapUtils.getNumber(in,"noKey",
>>>>>>>> val).intValue(), 0);
>>>>>>>>
>>>>>>>>        }
>>>>>>>>
>>>>>>>> @@ -1077,11 +1077,11 @@ public class MapUtilsTest extends
>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>            final Map<String, String> in = new HashMap<>();
>>>>>>>>            in.put("key", "str");
>>>>>>>>
>>>>>>>> -        assertEquals(MapUtils.getString(in,"key", "defualt"),
>>>> "str");
>>>>>>>> -        assertEquals(MapUtils.getString(in,"key"), "str");
>>>>>>>> -        assertEquals(MapUtils.getString(null,"key"), null);
>>>>>>>> -        assertEquals(MapUtils.getString(in,"noKey", "default"),
>>>>>>>> "default");
>>>>>>>> -        assertEquals(MapUtils.getString(null,"noKey", "default"),
>>>>>>>> "default");
>>>>>>>> +        assertEquals("str", MapUtils.getString(in,"key",
>>> "defualt"));
>>>>>>>> +        assertEquals("str", MapUtils.getString(in,"key"));
>>>>>>>> +        assertEquals(null, MapUtils.getString(null,"key"));
>>>>>>>> +        assertEquals("default", MapUtils.getString(in,"noKey",
>>>>>>>> "default"));
>>>>>>>> +        assertEquals("default", MapUtils.getString(null,"noKey",
>>>>>>>> "default"));
>>>>>>>>
>>>>>>>>        }
>>>>>>>>
>>>>>>>> @@ -1090,11 +1090,11 @@ public class MapUtilsTest extends
>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>            final Map<String, Object> in = new HashMap<>();
>>>>>>>>            in.put("key", "str");
>>>>>>>>
>>>>>>>> -        assertEquals(MapUtils.getObject(in,"key", "defualt"),
>>>> "str");
>>>>>>>> -        assertEquals(MapUtils.getObject(in,"key"), "str");
>>>>>>>> -        assertEquals(MapUtils.getObject(null,"key"), null);
>>>>>>>> -        assertEquals(MapUtils.getObject(in,"noKey", "default"),
>>>>>>>> "default");
>>>>>>>> -        assertEquals(MapUtils.getObject(null,"noKey", "default"),
>>>>>>>> "default");
>>>>>>>> +        assertEquals("str", MapUtils.getObject(in,"key",
>>> "defualt"));
>>>>>>>> +        assertEquals("str", MapUtils.getObject(in,"key"));
>>>>>>>> +        assertEquals(null, MapUtils.getObject(null,"key"));
>>>>>>>> +        assertEquals("default", MapUtils.getObject(in,"noKey",
>>>>>>>> "default"));
>>>>>>>> +        assertEquals("default", MapUtils.getObject(null,"noKey",
>>>>>>>> "default"));
>>>>>>>>
>>>>>>>>        }
>>>>>>>>
>>>>>>>> @@ -1109,7 +1109,7 @@ public class MapUtilsTest extends
>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>            assertTrue(!MapUtils.getBooleanValue(in,"noKey"));
>>>>>>>>            assertTrue(MapUtils.getBoolean(in,"key", true));
>>>>>>>>            assertTrue(MapUtils.getBoolean(in,"noKey", true));
>>>>>>>> -        assertEquals(MapUtils.getBoolean(null,"noKey"),null);
>>>>>>>> +        assertEquals(null, MapUtils.getBoolean(null,"noKey"));
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> @@ -1130,10 +1130,10 @@ public class MapUtilsTest extends
>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>            in.put("key1", valMap);
>>>>>>>>            final Map<?, ?> outValue =  MapUtils.getMap(in,"key1",
>>>> null);
>>>>>>>> -        assertEquals( outValue.get("key1"), "value1");
>>>>>>>> -        assertEquals( outValue.get("key2"), null);
>>>>>>>> -        assertEquals( MapUtils.getMap(in,"key2", null), null);
>>>>>>>> -        assertEquals( MapUtils.getMap(null,"key2", null), null);
>>>>>>>> +        assertEquals("value1", outValue.get("key1"));
>>>>>>>> +        assertEquals(null, outValue.get("key2"));
>>>>>>>> +        assertEquals(null, MapUtils.getMap(in,"key2", null));
>>>>>>>> +        assertEquals(null, MapUtils.getMap(null,"key2", null));
>>>>>>>>        }
>>>>>>>>
>>>>>>>>        @Test
>>>>>>>> @@ -1143,8 +1143,8 @@ public class MapUtilsTest extends
>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>
>>>>>>>>            MapUtils.safeAddToMap(inMap,"key1", "value1");
>>>>>>>>            MapUtils.safeAddToMap(inMap,"key2", null);
>>>>>>>> -        assertEquals( inMap.get("key1"), "value1");
>>>>>>>> -        assertEquals( inMap.get("key2"), "");
>>>>>>>> +        assertEquals("value1", inMap.get("key1"));
>>>>>>>> +        assertEquals("", inMap.get("key2"));
>>>>>>>>        }
>>>>>>>>
>>>>>>>>        @Test
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [hidden email]
>>>>> For additional commands, e-mail: [hidden email]
>>>>>
>>>>>
>>>
>>>
>>> --
>>> Matt Sicker <[hidden email]>
>>>
>>

Reply | Threaded
Open this post in threaded view
|

Re: commons-collections git commit: MapUtilsTest: fix order of expected and actual parameter in assertions (closes #32)

Bruno P. Kinoshita-3
Normally I'm against adding dependencies that are not normally used with other libraries. In most projects I use/contribute to, AssertJ is not used.
Said that, I learned to appreciate AssertJ after I wrote some code that handled several map objects. Writing tests to assert things about keys & values was boring, and I eventually added some bugs. A contributor submitted a pull request fixing my mistakes, and pointed me to AssertJ.
I think his code was similar to one of these examples.
https://github.com/joel-costigliola/assertj-examples/blob/master/assertions-examples/src/test/java/org/assertj/examples/MapAssertionsExamples.java
So even though it could be harder to maintain, as long as JUnit 5 works fine with AssertJ, I'd be +1 for that.
Cheers

      From: Pascal Schumacher <[hidden email]>
 To: [hidden email]
 Sent: Sunday, 15 October 2017 8:19 PM
 Subject: Re: commons-collections git commit: MapUtilsTest: fix order of expected and actual parameter in assertions (closes #32)
   
As mentioned by Matt, assertj focuses on providing assertions. Readable,
fluent assertions and helpful error messages.

It's basically as if Hamcrest added a fluent interface (so available
assertions are easy to discover) and continued development at full speed
after releasing 1.3, adding many additional matchers.

Some AssertJ examples copied from
https://joel-costigliola.github.io/assertj/

|// basic assertions assertThat(frodo.getName()).isEqualTo("Frodo");
assertThat(frodo).isNotEqualTo(sauron); // chaining string specific
assertions assertThat(frodo.getName()).startsWith("Fro") .endsWith("do")
.isEqualToIgnoringCase("frodo"); // collection specific assertions
(there are plenty more) // in the examples below fellowshipOfTheRing is
a List<TolkienCharacter
<https://github.com/joel-costigliola/assertj-examples/blob/java-8/assertions-examples/src/main/java/org/assertj/examples/data/TolkienCharacter.java>>
assertThat(fellowshipOfTheRing).hasSize(9) .contains(frodo, sam)
.doesNotContain(sauron);|


Am 14.10.2017 um 20:58 schrieb Gary Gregory:

> Darn, I meant TestNG.
>
> Gary
>
> On Sat, Oct 14, 2017 at 12:58 PM, Gary Gregory <[hidden email]>
> wrote:
>
>> How does it compare to RelaxNG?
>>
>> G
>>
>> On Sat, Oct 14, 2017 at 12:49 PM, Matt Sicker <[hidden email]> wrote:
>>
>>> AssertJ is an assertion library and works with JUnit or whatever testing
>>> framework you want. Essentially, it's a replacement for Hamcrest +
>>> org.junit.Assert.
>>>
>>> On 14 October 2017 at 13:27, Gary Gregory <[hidden email]> wrote:
>>>
>>>> I have no interest in switching from JUnit, especially with JUnit 5
>>> around
>>>> the corner.
>>>>
>>>> Gary
>>>>
>>>> On Sat, Oct 14, 2017 at 12:25 PM, Pascal Schumacher <
>>>> [hidden email]> wrote:
>>>>
>>>>> Any time. :-)
>>>>>
>>>>> Migrating is not hard, as there are scripts to do most of the work,
>>> see:
>>>>> https://joel-costigliola.github.io/assertj/assertj-core-
>>>>> converting-junit-assertions-to-assertj.html
>>>>>
>>>>> Am 14.10.2017 um 19:06 schrieb Benedikt Ritter:
>>>>>
>>>>>> About time we migrate to AssertJ. :-)
>>>>>>
>>>>>> Gary Gregory <[hidden email]> schrieb am Sa. 14. Okt. 2017
>>> um
>>>>>> 18:55:
>>>>>>
>>>>>> Thank you for doing that! That was driving me nuts!
>>>>>>> Gary
>>>>>>>
>>>>>>> On Oct 14, 2017 10:53, <[hidden email]> wrote:
>>>>>>>
>>>>>>> Repository: commons-collections
>>>>>>>> Updated Branches:
>>>>>>>>    refs/heads/master 641aa1c66 -> b9522976f
>>>>>>>>
>>>>>>>>
>>>>>>>> MapUtilsTest: fix order of expected and actual parameter in
>>> assertions
>>>>>>>> (closes #32)
>>>>>>>>
>>>>>>>>
>>>>>>>> Project: http://git-wip-us.apache.org/r
>>> epos/asf/commons-collections/r
>>>>>>>> epo
>>>>>>>> Commit: http://git-wip-us.apache.org/r
>>> epos/asf/commons-collections/
>>>>>>>> commit/b9522976
>>>>>>>> Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/
>>>>>>>> tree/b9522976
>>>>>>>> Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/
>>>>>>>> diff/b9522976
>>>>>>>>
>>>>>>>> Branch: refs/heads/master
>>>>>>>> Commit: b9522976f462687b0693b7229ba5c7faee0cb74b
>>>>>>>> Parents: 641aa1c
>>>>>>>> Author: Kavuri, Vamsi <[hidden email]>
>>>>>>>> Authored: Sat Oct 14 12:30:35 2017 -0400
>>>>>>>> Committer: pascalschumacher <[hidden email]>
>>>>>>>> Committed: Sat Oct 14 18:52:04 2017 +0200
>>>>>>>>
>>>>>>>> ------------------------------------------------------------
>>>> ----------
>>>>>>>>    .../commons/collections4/MapUtilsTest.java      | 110
>>>>>>>>
>>>>>>> +++++++++----------
>>>>>>>
>>>>>>>>    1 file changed, 55 insertions(+), 55 deletions(-)
>>>>>>>> ------------------------------------------------------------
>>>> ----------
>>>>>>>>
>>>>>>>> http://git-wip-us.apache.org/repos/asf/commons-collections/
>>>>>>>> blob/b9522976/src/test/java/org/apache/commons/
>>>>>>>> collections4/MapUtilsTest.java
>>>>>>>> ------------------------------------------------------------
>>>> ----------
>>>>>>>> diff --git
>>>>>>>>
>>>>>>> a/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
>>>>>>>
>>>>>>>> b/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
>>>>>>>> index fc3e3d6..21f20c4 100644
>>>>>>>> --- a/src/test/java/org/apache/commons/collections4/MapUtilsTest
>>> .java
>>>>>>>> +++ b/src/test/java/org/apache/commons/collections4/MapUtilsTest
>>> .java
>>>>>>>> @@ -950,12 +950,12 @@ public class MapUtilsTest extends
>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>            final Map<String, Double> in = new HashMap<>();
>>>>>>>>            in.put("key", 2.0);
>>>>>>>>
>>>>>>>> -        assertEquals(MapUtils.getDoubleValue(in,"key", 0.0), 2.0,
>>>> 0);
>>>>>>>> -        assertEquals(MapUtils.getDoubleValue(in,"key"), 2.0, 0);
>>>>>>>> -        assertEquals(MapUtils.getDoubleValue(in,"noKey", 1.0),
>>> 1.0,
>>>>>>>> 0);
>>>>>>>> -        assertEquals(MapUtils.getDoubleValue(in,"noKey"), 0, 0);
>>>>>>>> -        assertEquals(MapUtils.getDouble(in,"key", 0.0), 2.0, 0);
>>>>>>>> -        assertEquals(MapUtils.getDouble(in,"noKey", 1.0), 1.0,
>>> 0);
>>>>>>>> +        assertEquals(2.0, MapUtils.getDoubleValue(in,"key", 0.0),
>>>> 0);
>>>>>>>> +        assertEquals(2.0, MapUtils.getDoubleValue(in,"key"), 0);
>>>>>>>> +        assertEquals(1.0, MapUtils.getDoubleValue(in,"noKey",
>>> 1.0),
>>>>>>>> 0);
>>>>>>>> +        assertEquals(0, MapUtils.getDoubleValue(in,"noKey"), 0);
>>>>>>>> +        assertEquals(2.0, MapUtils.getDouble(in,"key", 0.0), 0);
>>>>>>>> +        assertEquals(1.0, MapUtils.getDouble(in,"noKey", 1.0), 0);
>>>>>>>>
>>>>>>>>
>>>>>>>>            final Map<String, String> inStr = new HashMap<>();
>>>>>>>> @@ -970,12 +970,12 @@ public class MapUtilsTest extends
>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>            final Map<String, Float> in = new HashMap<>();
>>>>>>>>            in.put("key", 2.0f);
>>>>>>>>
>>>>>>>> -        assertEquals(MapUtils.getFloatValue(in,"key", 0.0f), 2.0,
>>>> 0);
>>>>>>>> -        assertEquals(MapUtils.getFloatValue(in,"key"), 2.0, 0);
>>>>>>>> -        assertEquals(MapUtils.getFloatValue(in,"noKey", 1.0f),
>>> 1.0,
>>>>>>>> 0);
>>>>>>>> -        assertEquals(MapUtils.getFloatValue(in,"noKey"), 0, 0);
>>>>>>>> -        assertEquals(MapUtils.getFloat(in,"key", 0.0f), 2.0, 0);
>>>>>>>> -        assertEquals(MapUtils.getFloat(in,"noKey", 1.0f), 1.0,
>>> 0);
>>>>>>>> +        assertEquals(2.0, MapUtils.getFloatValue(in,"key", 0.0f),
>>>> 0);
>>>>>>>> +        assertEquals(2.0, MapUtils.getFloatValue(in,"key"), 0);
>>>>>>>> +        assertEquals(1.0, MapUtils.getFloatValue(in,"noKey",
>>> 1.0f),
>>>>>>>> 0);
>>>>>>>> +        assertEquals(0, MapUtils.getFloatValue(in,"noKey"), 0);
>>>>>>>> +        assertEquals(2.0, MapUtils.getFloat(in,"key", 0.0f), 0);
>>>>>>>> +        assertEquals(1.0, MapUtils.getFloat(in,"noKey", 1.0f), 0);
>>>>>>>>
>>>>>>>>            final Map<String, String> inStr = new HashMap<>();
>>>>>>>>            char decimalSeparator = getDecimalSeparator();
>>>>>>>> @@ -989,12 +989,12 @@ public class MapUtilsTest extends
>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>            final Map<String, Long> in = new HashMap<>();
>>>>>>>>            in.put("key", 2L);
>>>>>>>>
>>>>>>>> -        assertEquals(MapUtils.getLongValue(in,"key", 0L), 2.0,
>>> 0);
>>>>>>>> -        assertEquals(MapUtils.getLongValue(in,"key"), 2.0, 0);
>>>>>>>> -        assertEquals(MapUtils.getLongValue(in,"noKey", 1L), 1,
>>> 0);
>>>>>>>> -        assertEquals(MapUtils.getLongValue(in,"noKey"), 0, 0);
>>>>>>>> -        assertEquals(MapUtils.getLong(in,"key", 0L), 2.0, 0);
>>>>>>>> -        assertEquals(MapUtils.getLong(in,"noKey", 1L), 1, 0);
>>>>>>>> +        assertEquals(2.0, MapUtils.getLongValue(in,"key", 0L),
>>> 0);
>>>>>>>> +        assertEquals(2.0, MapUtils.getLongValue(in,"key"), 0);
>>>>>>>> +        assertEquals(1, MapUtils.getLongValue(in,"noKey", 1L),
>>> 0);
>>>>>>>> +        assertEquals(0, MapUtils.getLongValue(in,"noKey"), 0);
>>>>>>>> +        assertEquals(2.0, MapUtils.getLong(in,"key", 0L), 0);
>>>>>>>> +        assertEquals(1, MapUtils.getLong(in,"noKey", 1L), 0);
>>>>>>>>
>>>>>>>>            final Map<String, String> inStr = new HashMap<>();
>>>>>>>>            inStr.put("str1", "2");
>>>>>>>> @@ -1009,12 +1009,12 @@ public class MapUtilsTest extends
>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>            final Map<String, Integer> in = new HashMap<>();
>>>>>>>>            in.put("key", 2);
>>>>>>>>
>>>>>>>> -        assertEquals(MapUtils.getIntValue(in,"key", 0), 2, 0);
>>>>>>>> -        assertEquals(MapUtils.getIntValue(in,"key"), 2, 0);
>>>>>>>> -        assertEquals(MapUtils.getIntValue(in,"noKey", 0), 0, 0);
>>>>>>>> -        assertEquals(MapUtils.getIntValue(in,"noKey"), 0, 0);
>>>>>>>> -        assertEquals(MapUtils.getInteger(in,"key", 0), 2, 0);
>>>>>>>> -        assertEquals(MapUtils.getInteger(in,"noKey", 0), 0, 0);
>>>>>>>> +        assertEquals(2, MapUtils.getIntValue(in,"key", 0), 0);
>>>>>>>> +        assertEquals(2, MapUtils.getIntValue(in,"key"), 0);
>>>>>>>> +        assertEquals(0, MapUtils.getIntValue(in,"noKey", 0), 0);
>>>>>>>> +        assertEquals(0, MapUtils.getIntValue(in,"noKey"), 0);
>>>>>>>> +        assertEquals(2, MapUtils.getInteger(in,"key", 0), 0);
>>>>>>>> +        assertEquals(0, MapUtils.getInteger(in,"noKey", 0), 0);
>>>>>>>>
>>>>>>>>            final Map<String, String> inStr = new HashMap<>();
>>>>>>>>            inStr.put("str1", "2");
>>>>>>>> @@ -1028,12 +1028,12 @@ public class MapUtilsTest extends
>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>            final short val = 10;
>>>>>>>>            in.put("key", val);
>>>>>>>>
>>>>>>>> -        assertEquals(MapUtils.getShortValue(in,"key", val), val,
>>> 0);
>>>>>>>> -        assertEquals(MapUtils.getShortValue(in,"key"), val, 0);
>>>>>>>> -        assertEquals(MapUtils.getShortValue(in,"noKey", val),
>>> val,
>>>> 0);
>>>>>>>> -        assertEquals(MapUtils.getShortValue(in,"noKey"), 0, 0);
>>>>>>>> -        assertEquals(MapUtils.getShort(in,"key", val), val, 0);
>>>>>>>> -        assertEquals(MapUtils.getShort(in,"noKey", val), val, 0);
>>>>>>>> +        assertEquals(val, MapUtils.getShortValue(in,"key", val),
>>> 0);
>>>>>>>> +        assertEquals(val, MapUtils.getShortValue(in,"key"), 0);
>>>>>>>> +        assertEquals(val, MapUtils.getShortValue(in,"noKey",
>>> val),
>>>> 0);
>>>>>>>> +        assertEquals(0, MapUtils.getShortValue(in,"noKey"), 0);
>>>>>>>> +        assertEquals(val, MapUtils.getShort(in,"key", val), 0);
>>>>>>>> +        assertEquals(val,MapUtils.getShort(in,"noKey", val), 0);
>>>>>>>>
>>>>>>>>            final Map<String, String> inStr = new HashMap<>();
>>>>>>>>            inStr.put("str1", "10");
>>>>>>>> @@ -1047,12 +1047,12 @@ public class MapUtilsTest extends
>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>            final byte val = 100;
>>>>>>>>            in.put("key", val);
>>>>>>>>
>>>>>>>> -        assertEquals(MapUtils.getByteValue(in,"key", val), val,
>>> 0);
>>>>>>>> -        assertEquals(MapUtils.getByteValue(in,"key"), val, 0);
>>>>>>>> -        assertEquals(MapUtils.getByteValue(in,"noKey", val), val,
>>>> 0);
>>>>>>>> -        assertEquals(MapUtils.getByteValue(in,"noKey"), 0, 0);
>>>>>>>> -        assertEquals(MapUtils.getByte(in,"key", val), val, 0);
>>>>>>>> -        assertEquals(MapUtils.getByte(in,"noKey", val), val, 0);
>>>>>>>> +        assertEquals(val, MapUtils.getByteValue(in,"key", val),
>>> 0);
>>>>>>>> +        assertEquals(val, MapUtils.getByteValue(in,"key"), 0);
>>>>>>>> +        assertEquals(val, MapUtils.getByteValue(in,"noKey", val),
>>>> 0);
>>>>>>>> +        assertEquals(0, MapUtils.getByteValue(in,"noKey"), 0);
>>>>>>>> +        assertEquals(val, MapUtils.getByte(in,"key", val), 0);
>>>>>>>> +        assertEquals(val, MapUtils.getByte(in,"noKey", val), 0);
>>>>>>>>
>>>>>>>>
>>>>>>>>            final Map<String, String> inStr = new HashMap<>();
>>>>>>>> @@ -1067,8 +1067,8 @@ public class MapUtilsTest extends
>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>            final Number val = 1000;
>>>>>>>>            in.put("key", val);
>>>>>>>>
>>>>>>>> -        assertEquals(MapUtils.getNumber(in,"key",
>>> val).intValue(),
>>>>>>>> val.intValue(), 0);
>>>>>>>> -        assertEquals(MapUtils.getNumber(in,"noKey",
>>> val).intValue(),
>>>>>>>> val.intValue(), 0);
>>>>>>>> +        assertEquals(val.intValue(), MapUtils.getNumber(in,"key",
>>>>>>>> val).intValue(), 0);
>>>>>>>> +        assertEquals(val.intValue(),
>>> MapUtils.getNumber(in,"noKey",
>>>>>>>> val).intValue(), 0);
>>>>>>>>
>>>>>>>>        }
>>>>>>>>
>>>>>>>> @@ -1077,11 +1077,11 @@ public class MapUtilsTest extends
>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>            final Map<String, String> in = new HashMap<>();
>>>>>>>>            in.put("key", "str");
>>>>>>>>
>>>>>>>> -        assertEquals(MapUtils.getString(in,"key", "defualt"),
>>>> "str");
>>>>>>>> -        assertEquals(MapUtils.getString(in,"key"), "str");
>>>>>>>> -        assertEquals(MapUtils.getString(null,"key"), null);
>>>>>>>> -        assertEquals(MapUtils.getString(in,"noKey", "default"),
>>>>>>>> "default");
>>>>>>>> -        assertEquals(MapUtils.getString(null,"noKey", "default"),
>>>>>>>> "default");
>>>>>>>> +        assertEquals("str", MapUtils.getString(in,"key",
>>> "defualt"));
>>>>>>>> +        assertEquals("str", MapUtils.getString(in,"key"));
>>>>>>>> +        assertEquals(null, MapUtils.getString(null,"key"));
>>>>>>>> +        assertEquals("default", MapUtils.getString(in,"noKey",
>>>>>>>> "default"));
>>>>>>>> +        assertEquals("default", MapUtils.getString(null,"noKey",
>>>>>>>> "default"));
>>>>>>>>
>>>>>>>>        }
>>>>>>>>
>>>>>>>> @@ -1090,11 +1090,11 @@ public class MapUtilsTest extends
>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>            final Map<String, Object> in = new HashMap<>();
>>>>>>>>            in.put("key", "str");
>>>>>>>>
>>>>>>>> -        assertEquals(MapUtils.getObject(in,"key", "defualt"),
>>>> "str");
>>>>>>>> -        assertEquals(MapUtils.getObject(in,"key"), "str");
>>>>>>>> -        assertEquals(MapUtils.getObject(null,"key"), null);
>>>>>>>> -        assertEquals(MapUtils.getObject(in,"noKey", "default"),
>>>>>>>> "default");
>>>>>>>> -        assertEquals(MapUtils.getObject(null,"noKey", "default"),
>>>>>>>> "default");
>>>>>>>> +        assertEquals("str", MapUtils.getObject(in,"key",
>>> "defualt"));
>>>>>>>> +        assertEquals("str", MapUtils.getObject(in,"key"));
>>>>>>>> +        assertEquals(null, MapUtils.getObject(null,"key"));
>>>>>>>> +        assertEquals("default", MapUtils.getObject(in,"noKey",
>>>>>>>> "default"));
>>>>>>>> +        assertEquals("default", MapUtils.getObject(null,"noKey",
>>>>>>>> "default"));
>>>>>>>>
>>>>>>>>        }
>>>>>>>>
>>>>>>>> @@ -1109,7 +1109,7 @@ public class MapUtilsTest extends
>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>            assertTrue(!MapUtils.getBooleanValue(in,"noKey"));
>>>>>>>>            assertTrue(MapUtils.getBoolean(in,"key", true));
>>>>>>>>            assertTrue(MapUtils.getBoolean(in,"noKey", true));
>>>>>>>> -        assertEquals(MapUtils.getBoolean(null,"noKey"),null);
>>>>>>>> +        assertEquals(null, MapUtils.getBoolean(null,"noKey"));
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> @@ -1130,10 +1130,10 @@ public class MapUtilsTest extends
>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>            in.put("key1", valMap);
>>>>>>>>            final Map<?, ?> outValue =  MapUtils.getMap(in,"key1",
>>>> null);
>>>>>>>> -        assertEquals( outValue.get("key1"), "value1");
>>>>>>>> -        assertEquals( outValue.get("key2"), null);
>>>>>>>> -        assertEquals( MapUtils.getMap(in,"key2", null), null);
>>>>>>>> -        assertEquals( MapUtils.getMap(null,"key2", null), null);
>>>>>>>> +        assertEquals("value1", outValue.get("key1"));
>>>>>>>> +        assertEquals(null, outValue.get("key2"));
>>>>>>>> +        assertEquals(null, MapUtils.getMap(in,"key2", null));
>>>>>>>> +        assertEquals(null, MapUtils.getMap(null,"key2", null));
>>>>>>>>        }
>>>>>>>>
>>>>>>>>        @Test
>>>>>>>> @@ -1143,8 +1143,8 @@ public class MapUtilsTest extends
>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>
>>>>>>>>            MapUtils.safeAddToMap(inMap,"key1", "value1");
>>>>>>>>            MapUtils.safeAddToMap(inMap,"key2", null);
>>>>>>>> -        assertEquals( inMap.get("key1"), "value1");
>>>>>>>> -        assertEquals( inMap.get("key2"), "");
>>>>>>>> +        assertEquals("value1", inMap.get("key1"));
>>>>>>>> +        assertEquals("", inMap.get("key2"));
>>>>>>>>        }
>>>>>>>>
>>>>>>>>        @Test
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [hidden email]
>>>>> For additional commands, e-mail: [hidden email]
>>>>>
>>>>>
>>>
>>>
>>> --
>>> Matt Sicker <[hidden email]>
>>>
>>



   
Reply | Threaded
Open this post in threaded view
|

Re: commons-collections git commit: MapUtilsTest: fix order of expected and actual parameter in assertions (closes #32)

Pascal Schumacher
Yes AssertJ works fine with JUnit 5. The JUnit team uses AssertJ
assertions (in combination with JUnit 5) for the unit test of JUnit 5.

Am 15.10.2017 um 10:39 schrieb Bruno P. Kinoshita:

> Normally I'm against adding dependencies that are not normally used with other libraries. In most projects I use/contribute to, AssertJ is not used.
> Said that, I learned to appreciate AssertJ after I wrote some code that handled several map objects. Writing tests to assert things about keys & values was boring, and I eventually added some bugs. A contributor submitted a pull request fixing my mistakes, and pointed me to AssertJ.
> I think his code was similar to one of these examples.
> https://github.com/joel-costigliola/assertj-examples/blob/master/assertions-examples/src/test/java/org/assertj/examples/MapAssertionsExamples.java
> So even though it could be harder to maintain, as long as JUnit 5 works fine with AssertJ, I'd be +1 for that.
> Cheers
>
>        From: Pascal Schumacher <[hidden email]>
>   To: [hidden email]
>   Sent: Sunday, 15 October 2017 8:19 PM
>   Subject: Re: commons-collections git commit: MapUtilsTest: fix order of expected and actual parameter in assertions (closes #32)
>    
> As mentioned by Matt, assertj focuses on providing assertions. Readable,
> fluent assertions and helpful error messages.
>
> It's basically as if Hamcrest added a fluent interface (so available
> assertions are easy to discover) and continued development at full speed
> after releasing 1.3, adding many additional matchers.
>
> Some AssertJ examples copied from
> https://joel-costigliola.github.io/assertj/
>
> |// basic assertions assertThat(frodo.getName()).isEqualTo("Frodo");
> assertThat(frodo).isNotEqualTo(sauron); // chaining string specific
> assertions assertThat(frodo.getName()).startsWith("Fro") .endsWith("do")
> .isEqualToIgnoringCase("frodo"); // collection specific assertions
> (there are plenty more) // in the examples below fellowshipOfTheRing is
> a List<TolkienCharacter
> <https://github.com/joel-costigliola/assertj-examples/blob/java-8/assertions-examples/src/main/java/org/assertj/examples/data/TolkienCharacter.java>>
> assertThat(fellowshipOfTheRing).hasSize(9) .contains(frodo, sam)
> .doesNotContain(sauron);|
>
>
> Am 14.10.2017 um 20:58 schrieb Gary Gregory:
>> Darn, I meant TestNG.
>>
>> Gary
>>
>> On Sat, Oct 14, 2017 at 12:58 PM, Gary Gregory <[hidden email]>
>> wrote:
>>
>>> How does it compare to RelaxNG?
>>>
>>> G
>>>
>>> On Sat, Oct 14, 2017 at 12:49 PM, Matt Sicker <[hidden email]> wrote:
>>>
>>>> AssertJ is an assertion library and works with JUnit or whatever testing
>>>> framework you want. Essentially, it's a replacement for Hamcrest +
>>>> org.junit.Assert.
>>>>
>>>> On 14 October 2017 at 13:27, Gary Gregory <[hidden email]> wrote:
>>>>
>>>>> I have no interest in switching from JUnit, especially with JUnit 5
>>>> around
>>>>> the corner.
>>>>>
>>>>> Gary
>>>>>
>>>>> On Sat, Oct 14, 2017 at 12:25 PM, Pascal Schumacher <
>>>>> [hidden email]> wrote:
>>>>>
>>>>>> Any time. :-)
>>>>>>
>>>>>> Migrating is not hard, as there are scripts to do most of the work,
>>>> see:
>>>>>> https://joel-costigliola.github.io/assertj/assertj-core-
>>>>>> converting-junit-assertions-to-assertj.html
>>>>>>
>>>>>> Am 14.10.2017 um 19:06 schrieb Benedikt Ritter:
>>>>>>
>>>>>>> About time we migrate to AssertJ. :-)
>>>>>>>
>>>>>>> Gary Gregory <[hidden email]> schrieb am Sa. 14. Okt. 2017
>>>> um
>>>>>>> 18:55:
>>>>>>>
>>>>>>> Thank you for doing that! That was driving me nuts!
>>>>>>>> Gary
>>>>>>>>
>>>>>>>> On Oct 14, 2017 10:53, <[hidden email]> wrote:
>>>>>>>>
>>>>>>>> Repository: commons-collections
>>>>>>>>> Updated Branches:
>>>>>>>>>      refs/heads/master 641aa1c66 -> b9522976f
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> MapUtilsTest: fix order of expected and actual parameter in
>>>> assertions
>>>>>>>>> (closes #32)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Project: http://git-wip-us.apache.org/r
>>>> epos/asf/commons-collections/r
>>>>>>>>> epo
>>>>>>>>> Commit: http://git-wip-us.apache.org/r
>>>> epos/asf/commons-collections/
>>>>>>>>> commit/b9522976
>>>>>>>>> Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/
>>>>>>>>> tree/b9522976
>>>>>>>>> Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/
>>>>>>>>> diff/b9522976
>>>>>>>>>
>>>>>>>>> Branch: refs/heads/master
>>>>>>>>> Commit: b9522976f462687b0693b7229ba5c7faee0cb74b
>>>>>>>>> Parents: 641aa1c
>>>>>>>>> Author: Kavuri, Vamsi <[hidden email]>
>>>>>>>>> Authored: Sat Oct 14 12:30:35 2017 -0400
>>>>>>>>> Committer: pascalschumacher <[hidden email]>
>>>>>>>>> Committed: Sat Oct 14 18:52:04 2017 +0200
>>>>>>>>>
>>>>>>>>> ------------------------------------------------------------
>>>>> ----------
>>>>>>>>>      .../commons/collections4/MapUtilsTest.java      | 110
>>>>>>>>>
>>>>>>>> +++++++++----------
>>>>>>>>
>>>>>>>>>      1 file changed, 55 insertions(+), 55 deletions(-)
>>>>>>>>> ------------------------------------------------------------
>>>>> ----------
>>>>>>>>> http://git-wip-us.apache.org/repos/asf/commons-collections/
>>>>>>>>> blob/b9522976/src/test/java/org/apache/commons/
>>>>>>>>> collections4/MapUtilsTest.java
>>>>>>>>> ------------------------------------------------------------
>>>>> ----------
>>>>>>>>> diff --git
>>>>>>>>>
>>>>>>>> a/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
>>>>>>>>
>>>>>>>>> b/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
>>>>>>>>> index fc3e3d6..21f20c4 100644
>>>>>>>>> --- a/src/test/java/org/apache/commons/collections4/MapUtilsTest
>>>> .java
>>>>>>>>> +++ b/src/test/java/org/apache/commons/collections4/MapUtilsTest
>>>> .java
>>>>>>>>> @@ -950,12 +950,12 @@ public class MapUtilsTest extends
>>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>>              final Map<String, Double> in = new HashMap<>();
>>>>>>>>>              in.put("key", 2.0);
>>>>>>>>>
>>>>>>>>> -        assertEquals(MapUtils.getDoubleValue(in,"key", 0.0), 2.0,
>>>>> 0);
>>>>>>>>> -        assertEquals(MapUtils.getDoubleValue(in,"key"), 2.0, 0);
>>>>>>>>> -        assertEquals(MapUtils.getDoubleValue(in,"noKey", 1.0),
>>>> 1.0,
>>>>>>>>> 0);
>>>>>>>>> -        assertEquals(MapUtils.getDoubleValue(in,"noKey"), 0, 0);
>>>>>>>>> -        assertEquals(MapUtils.getDouble(in,"key", 0.0), 2.0, 0);
>>>>>>>>> -        assertEquals(MapUtils.getDouble(in,"noKey", 1.0), 1.0,
>>>> 0);
>>>>>>>>> +        assertEquals(2.0, MapUtils.getDoubleValue(in,"key", 0.0),
>>>>> 0);
>>>>>>>>> +        assertEquals(2.0, MapUtils.getDoubleValue(in,"key"), 0);
>>>>>>>>> +        assertEquals(1.0, MapUtils.getDoubleValue(in,"noKey",
>>>> 1.0),
>>>>>>>>> 0);
>>>>>>>>> +        assertEquals(0, MapUtils.getDoubleValue(in,"noKey"), 0);
>>>>>>>>> +        assertEquals(2.0, MapUtils.getDouble(in,"key", 0.0), 0);
>>>>>>>>> +        assertEquals(1.0, MapUtils.getDouble(in,"noKey", 1.0), 0);
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>              final Map<String, String> inStr = new HashMap<>();
>>>>>>>>> @@ -970,12 +970,12 @@ public class MapUtilsTest extends
>>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>>              final Map<String, Float> in = new HashMap<>();
>>>>>>>>>              in.put("key", 2.0f);
>>>>>>>>>
>>>>>>>>> -        assertEquals(MapUtils.getFloatValue(in,"key", 0.0f), 2.0,
>>>>> 0);
>>>>>>>>> -        assertEquals(MapUtils.getFloatValue(in,"key"), 2.0, 0);
>>>>>>>>> -        assertEquals(MapUtils.getFloatValue(in,"noKey", 1.0f),
>>>> 1.0,
>>>>>>>>> 0);
>>>>>>>>> -        assertEquals(MapUtils.getFloatValue(in,"noKey"), 0, 0);
>>>>>>>>> -        assertEquals(MapUtils.getFloat(in,"key", 0.0f), 2.0, 0);
>>>>>>>>> -        assertEquals(MapUtils.getFloat(in,"noKey", 1.0f), 1.0,
>>>> 0);
>>>>>>>>> +        assertEquals(2.0, MapUtils.getFloatValue(in,"key", 0.0f),
>>>>> 0);
>>>>>>>>> +        assertEquals(2.0, MapUtils.getFloatValue(in,"key"), 0);
>>>>>>>>> +        assertEquals(1.0, MapUtils.getFloatValue(in,"noKey",
>>>> 1.0f),
>>>>>>>>> 0);
>>>>>>>>> +        assertEquals(0, MapUtils.getFloatValue(in,"noKey"), 0);
>>>>>>>>> +        assertEquals(2.0, MapUtils.getFloat(in,"key", 0.0f), 0);
>>>>>>>>> +        assertEquals(1.0, MapUtils.getFloat(in,"noKey", 1.0f), 0);
>>>>>>>>>
>>>>>>>>>              final Map<String, String> inStr = new HashMap<>();
>>>>>>>>>              char decimalSeparator = getDecimalSeparator();
>>>>>>>>> @@ -989,12 +989,12 @@ public class MapUtilsTest extends
>>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>>              final Map<String, Long> in = new HashMap<>();
>>>>>>>>>              in.put("key", 2L);
>>>>>>>>>
>>>>>>>>> -        assertEquals(MapUtils.getLongValue(in,"key", 0L), 2.0,
>>>> 0);
>>>>>>>>> -        assertEquals(MapUtils.getLongValue(in,"key"), 2.0, 0);
>>>>>>>>> -        assertEquals(MapUtils.getLongValue(in,"noKey", 1L), 1,
>>>> 0);
>>>>>>>>> -        assertEquals(MapUtils.getLongValue(in,"noKey"), 0, 0);
>>>>>>>>> -        assertEquals(MapUtils.getLong(in,"key", 0L), 2.0, 0);
>>>>>>>>> -        assertEquals(MapUtils.getLong(in,"noKey", 1L), 1, 0);
>>>>>>>>> +        assertEquals(2.0, MapUtils.getLongValue(in,"key", 0L),
>>>> 0);
>>>>>>>>> +        assertEquals(2.0, MapUtils.getLongValue(in,"key"), 0);
>>>>>>>>> +        assertEquals(1, MapUtils.getLongValue(in,"noKey", 1L),
>>>> 0);
>>>>>>>>> +        assertEquals(0, MapUtils.getLongValue(in,"noKey"), 0);
>>>>>>>>> +        assertEquals(2.0, MapUtils.getLong(in,"key", 0L), 0);
>>>>>>>>> +        assertEquals(1, MapUtils.getLong(in,"noKey", 1L), 0);
>>>>>>>>>
>>>>>>>>>              final Map<String, String> inStr = new HashMap<>();
>>>>>>>>>              inStr.put("str1", "2");
>>>>>>>>> @@ -1009,12 +1009,12 @@ public class MapUtilsTest extends
>>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>>              final Map<String, Integer> in = new HashMap<>();
>>>>>>>>>              in.put("key", 2);
>>>>>>>>>
>>>>>>>>> -        assertEquals(MapUtils.getIntValue(in,"key", 0), 2, 0);
>>>>>>>>> -        assertEquals(MapUtils.getIntValue(in,"key"), 2, 0);
>>>>>>>>> -        assertEquals(MapUtils.getIntValue(in,"noKey", 0), 0, 0);
>>>>>>>>> -        assertEquals(MapUtils.getIntValue(in,"noKey"), 0, 0);
>>>>>>>>> -        assertEquals(MapUtils.getInteger(in,"key", 0), 2, 0);
>>>>>>>>> -        assertEquals(MapUtils.getInteger(in,"noKey", 0), 0, 0);
>>>>>>>>> +        assertEquals(2, MapUtils.getIntValue(in,"key", 0), 0);
>>>>>>>>> +        assertEquals(2, MapUtils.getIntValue(in,"key"), 0);
>>>>>>>>> +        assertEquals(0, MapUtils.getIntValue(in,"noKey", 0), 0);
>>>>>>>>> +        assertEquals(0, MapUtils.getIntValue(in,"noKey"), 0);
>>>>>>>>> +        assertEquals(2, MapUtils.getInteger(in,"key", 0), 0);
>>>>>>>>> +        assertEquals(0, MapUtils.getInteger(in,"noKey", 0), 0);
>>>>>>>>>
>>>>>>>>>              final Map<String, String> inStr = new HashMap<>();
>>>>>>>>>              inStr.put("str1", "2");
>>>>>>>>> @@ -1028,12 +1028,12 @@ public class MapUtilsTest extends
>>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>>              final short val = 10;
>>>>>>>>>              in.put("key", val);
>>>>>>>>>
>>>>>>>>> -        assertEquals(MapUtils.getShortValue(in,"key", val), val,
>>>> 0);
>>>>>>>>> -        assertEquals(MapUtils.getShortValue(in,"key"), val, 0);
>>>>>>>>> -        assertEquals(MapUtils.getShortValue(in,"noKey", val),
>>>> val,
>>>>> 0);
>>>>>>>>> -        assertEquals(MapUtils.getShortValue(in,"noKey"), 0, 0);
>>>>>>>>> -        assertEquals(MapUtils.getShort(in,"key", val), val, 0);
>>>>>>>>> -        assertEquals(MapUtils.getShort(in,"noKey", val), val, 0);
>>>>>>>>> +        assertEquals(val, MapUtils.getShortValue(in,"key", val),
>>>> 0);
>>>>>>>>> +        assertEquals(val, MapUtils.getShortValue(in,"key"), 0);
>>>>>>>>> +        assertEquals(val, MapUtils.getShortValue(in,"noKey",
>>>> val),
>>>>> 0);
>>>>>>>>> +        assertEquals(0, MapUtils.getShortValue(in,"noKey"), 0);
>>>>>>>>> +        assertEquals(val, MapUtils.getShort(in,"key", val), 0);
>>>>>>>>> +        assertEquals(val,MapUtils.getShort(in,"noKey", val), 0);
>>>>>>>>>
>>>>>>>>>              final Map<String, String> inStr = new HashMap<>();
>>>>>>>>>              inStr.put("str1", "10");
>>>>>>>>> @@ -1047,12 +1047,12 @@ public class MapUtilsTest extends
>>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>>              final byte val = 100;
>>>>>>>>>              in.put("key", val);
>>>>>>>>>
>>>>>>>>> -        assertEquals(MapUtils.getByteValue(in,"key", val), val,
>>>> 0);
>>>>>>>>> -        assertEquals(MapUtils.getByteValue(in,"key"), val, 0);
>>>>>>>>> -        assertEquals(MapUtils.getByteValue(in,"noKey", val), val,
>>>>> 0);
>>>>>>>>> -        assertEquals(MapUtils.getByteValue(in,"noKey"), 0, 0);
>>>>>>>>> -        assertEquals(MapUtils.getByte(in,"key", val), val, 0);
>>>>>>>>> -        assertEquals(MapUtils.getByte(in,"noKey", val), val, 0);
>>>>>>>>> +        assertEquals(val, MapUtils.getByteValue(in,"key", val),
>>>> 0);
>>>>>>>>> +        assertEquals(val, MapUtils.getByteValue(in,"key"), 0);
>>>>>>>>> +        assertEquals(val, MapUtils.getByteValue(in,"noKey", val),
>>>>> 0);
>>>>>>>>> +        assertEquals(0, MapUtils.getByteValue(in,"noKey"), 0);
>>>>>>>>> +        assertEquals(val, MapUtils.getByte(in,"key", val), 0);
>>>>>>>>> +        assertEquals(val, MapUtils.getByte(in,"noKey", val), 0);
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>              final Map<String, String> inStr = new HashMap<>();
>>>>>>>>> @@ -1067,8 +1067,8 @@ public class MapUtilsTest extends
>>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>>              final Number val = 1000;
>>>>>>>>>              in.put("key", val);
>>>>>>>>>
>>>>>>>>> -        assertEquals(MapUtils.getNumber(in,"key",
>>>> val).intValue(),
>>>>>>>>> val.intValue(), 0);
>>>>>>>>> -        assertEquals(MapUtils.getNumber(in,"noKey",
>>>> val).intValue(),
>>>>>>>>> val.intValue(), 0);
>>>>>>>>> +        assertEquals(val.intValue(), MapUtils.getNumber(in,"key",
>>>>>>>>> val).intValue(), 0);
>>>>>>>>> +        assertEquals(val.intValue(),
>>>> MapUtils.getNumber(in,"noKey",
>>>>>>>>> val).intValue(), 0);
>>>>>>>>>
>>>>>>>>>          }
>>>>>>>>>
>>>>>>>>> @@ -1077,11 +1077,11 @@ public class MapUtilsTest extends
>>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>>              final Map<String, String> in = new HashMap<>();
>>>>>>>>>              in.put("key", "str");
>>>>>>>>>
>>>>>>>>> -        assertEquals(MapUtils.getString(in,"key", "defualt"),
>>>>> "str");
>>>>>>>>> -        assertEquals(MapUtils.getString(in,"key"), "str");
>>>>>>>>> -        assertEquals(MapUtils.getString(null,"key"), null);
>>>>>>>>> -        assertEquals(MapUtils.getString(in,"noKey", "default"),
>>>>>>>>> "default");
>>>>>>>>> -        assertEquals(MapUtils.getString(null,"noKey", "default"),
>>>>>>>>> "default");
>>>>>>>>> +        assertEquals("str", MapUtils.getString(in,"key",
>>>> "defualt"));
>>>>>>>>> +        assertEquals("str", MapUtils.getString(in,"key"));
>>>>>>>>> +        assertEquals(null, MapUtils.getString(null,"key"));
>>>>>>>>> +        assertEquals("default", MapUtils.getString(in,"noKey",
>>>>>>>>> "default"));
>>>>>>>>> +        assertEquals("default", MapUtils.getString(null,"noKey",
>>>>>>>>> "default"));
>>>>>>>>>
>>>>>>>>>          }
>>>>>>>>>
>>>>>>>>> @@ -1090,11 +1090,11 @@ public class MapUtilsTest extends
>>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>>              final Map<String, Object> in = new HashMap<>();
>>>>>>>>>              in.put("key", "str");
>>>>>>>>>
>>>>>>>>> -        assertEquals(MapUtils.getObject(in,"key", "defualt"),
>>>>> "str");
>>>>>>>>> -        assertEquals(MapUtils.getObject(in,"key"), "str");
>>>>>>>>> -        assertEquals(MapUtils.getObject(null,"key"), null);
>>>>>>>>> -        assertEquals(MapUtils.getObject(in,"noKey", "default"),
>>>>>>>>> "default");
>>>>>>>>> -        assertEquals(MapUtils.getObject(null,"noKey", "default"),
>>>>>>>>> "default");
>>>>>>>>> +        assertEquals("str", MapUtils.getObject(in,"key",
>>>> "defualt"));
>>>>>>>>> +        assertEquals("str", MapUtils.getObject(in,"key"));
>>>>>>>>> +        assertEquals(null, MapUtils.getObject(null,"key"));
>>>>>>>>> +        assertEquals("default", MapUtils.getObject(in,"noKey",
>>>>>>>>> "default"));
>>>>>>>>> +        assertEquals("default", MapUtils.getObject(null,"noKey",
>>>>>>>>> "default"));
>>>>>>>>>
>>>>>>>>>          }
>>>>>>>>>
>>>>>>>>> @@ -1109,7 +1109,7 @@ public class MapUtilsTest extends
>>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>>              assertTrue(!MapUtils.getBooleanValue(in,"noKey"));
>>>>>>>>>              assertTrue(MapUtils.getBoolean(in,"key", true));
>>>>>>>>>              assertTrue(MapUtils.getBoolean(in,"noKey", true));
>>>>>>>>> -        assertEquals(MapUtils.getBoolean(null,"noKey"),null);
>>>>>>>>> +        assertEquals(null, MapUtils.getBoolean(null,"noKey"));
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> @@ -1130,10 +1130,10 @@ public class MapUtilsTest extends
>>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>>              in.put("key1", valMap);
>>>>>>>>>              final Map<?, ?> outValue =  MapUtils.getMap(in,"key1",
>>>>> null);
>>>>>>>>> -        assertEquals( outValue.get("key1"), "value1");
>>>>>>>>> -        assertEquals( outValue.get("key2"), null);
>>>>>>>>> -        assertEquals( MapUtils.getMap(in,"key2", null), null);
>>>>>>>>> -        assertEquals( MapUtils.getMap(null,"key2", null), null);
>>>>>>>>> +        assertEquals("value1", outValue.get("key1"));
>>>>>>>>> +        assertEquals(null, outValue.get("key2"));
>>>>>>>>> +        assertEquals(null, MapUtils.getMap(in,"key2", null));
>>>>>>>>> +        assertEquals(null, MapUtils.getMap(null,"key2", null));
>>>>>>>>>          }
>>>>>>>>>
>>>>>>>>>          @Test
>>>>>>>>> @@ -1143,8 +1143,8 @@ public class MapUtilsTest extends
>>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>>
>>>>>>>>>              MapUtils.safeAddToMap(inMap,"key1", "value1");
>>>>>>>>>              MapUtils.safeAddToMap(inMap,"key2", null);
>>>>>>>>> -        assertEquals( inMap.get("key1"), "value1");
>>>>>>>>> -        assertEquals( inMap.get("key2"), "");
>>>>>>>>> +        assertEquals("value1", inMap.get("key1"));
>>>>>>>>> +        assertEquals("", inMap.get("key2"));
>>>>>>>>>          }
>>>>>>>>>
>>>>>>>>>          @Test
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: [hidden email]
>>>>>> For additional commands, e-mail: [hidden email]
>>>>>>
>>>>>>
>>>>
>>>> --
>>>> Matt Sicker <[hidden email]>
>>>>
>
>
>    



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: commons-collections git commit: MapUtilsTest: fix order of expected and actual parameter in assertions (closes #32)

Bruno P. Kinoshita-3
Great to know ! (making a note to add it to the backlog at work)
Keen to give it a try in some component.
ThanksBruno

      From: Pascal Schumacher <[hidden email]>
 To: [hidden email]
 Sent: Sunday, 15 October 2017 9:51 PM
 Subject: Re: commons-collections git commit: MapUtilsTest: fix order of expected and actual parameter in assertions (closes #32)
   
Yes AssertJ works fine with JUnit 5. The JUnit team uses AssertJ
assertions (in combination with JUnit 5) for the unit test of JUnit 5.

Am 15.10.2017 um 10:39 schrieb Bruno P. Kinoshita:

> Normally I'm against adding dependencies that are not normally used with other libraries. In most projects I use/contribute to, AssertJ is not used.
> Said that, I learned to appreciate AssertJ after I wrote some code that handled several map objects. Writing tests to assert things about keys & values was boring, and I eventually added some bugs. A contributor submitted a pull request fixing my mistakes, and pointed me to AssertJ.
> I think his code was similar to one of these examples.
> https://github.com/joel-costigliola/assertj-examples/blob/master/assertions-examples/src/test/java/org/assertj/examples/MapAssertionsExamples.java
> So even though it could be harder to maintain, as long as JUnit 5 works fine with AssertJ, I'd be +1 for that.
> Cheers
>
>        From: Pascal Schumacher <[hidden email]>
>  To: [hidden email]
>  Sent: Sunday, 15 October 2017 8:19 PM
>  Subject: Re: commons-collections git commit: MapUtilsTest: fix order of expected and actual parameter in assertions (closes #32)
>   
> As mentioned by Matt, assertj focuses on providing assertions. Readable,
> fluent assertions and helpful error messages.
>
> It's basically as if Hamcrest added a fluent interface (so available
> assertions are easy to discover) and continued development at full speed
> after releasing 1.3, adding many additional matchers.
>
> Some AssertJ examples copied from
> https://joel-costigliola.github.io/assertj/
>
> |// basic assertions assertThat(frodo.getName()).isEqualTo("Frodo");
> assertThat(frodo).isNotEqualTo(sauron); // chaining string specific
> assertions assertThat(frodo.getName()).startsWith("Fro") .endsWith("do")
> .isEqualToIgnoringCase("frodo"); // collection specific assertions
> (there are plenty more) // in the examples below fellowshipOfTheRing is
> a List<TolkienCharacter
> <https://github.com/joel-costigliola/assertj-examples/blob/java-8/assertions-examples/src/main/java/org/assertj/examples/data/TolkienCharacter.java>>
> assertThat(fellowshipOfTheRing).hasSize(9) .contains(frodo, sam)
> .doesNotContain(sauron);|
>
>
> Am 14.10.2017 um 20:58 schrieb Gary Gregory:
>> Darn, I meant TestNG.
>>
>> Gary
>>
>> On Sat, Oct 14, 2017 at 12:58 PM, Gary Gregory <[hidden email]>
>> wrote:
>>
>>> How does it compare to RelaxNG?
>>>
>>> G
>>>
>>> On Sat, Oct 14, 2017 at 12:49 PM, Matt Sicker <[hidden email]> wrote:
>>>
>>>> AssertJ is an assertion library and works with JUnit or whatever testing
>>>> framework you want. Essentially, it's a replacement for Hamcrest +
>>>> org.junit.Assert.
>>>>
>>>> On 14 October 2017 at 13:27, Gary Gregory <[hidden email]> wrote:
>>>>
>>>>> I have no interest in switching from JUnit, especially with JUnit 5
>>>> around
>>>>> the corner.
>>>>>
>>>>> Gary
>>>>>
>>>>> On Sat, Oct 14, 2017 at 12:25 PM, Pascal Schumacher <
>>>>> [hidden email]> wrote:
>>>>>
>>>>>> Any time. :-)
>>>>>>
>>>>>> Migrating is not hard, as there are scripts to do most of the work,
>>>> see:
>>>>>> https://joel-costigliola.github.io/assertj/assertj-core-
>>>>>> converting-junit-assertions-to-assertj.html
>>>>>>
>>>>>> Am 14.10.2017 um 19:06 schrieb Benedikt Ritter:
>>>>>>
>>>>>>> About time we migrate to AssertJ. :-)
>>>>>>>
>>>>>>> Gary Gregory <[hidden email]> schrieb am Sa. 14. Okt. 2017
>>>> um
>>>>>>> 18:55:
>>>>>>>
>>>>>>> Thank you for doing that! That was driving me nuts!
>>>>>>>> Gary
>>>>>>>>
>>>>>>>> On Oct 14, 2017 10:53, <[hidden email]> wrote:
>>>>>>>>
>>>>>>>> Repository: commons-collections
>>>>>>>>> Updated Branches:
>>>>>>>>>      refs/heads/master 641aa1c66 -> b9522976f
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> MapUtilsTest: fix order of expected and actual parameter in
>>>> assertions
>>>>>>>>> (closes #32)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Project: http://git-wip-us.apache.org/r
>>>> epos/asf/commons-collections/r
>>>>>>>>> epo
>>>>>>>>> Commit: http://git-wip-us.apache.org/r
>>>> epos/asf/commons-collections/
>>>>>>>>> commit/b9522976
>>>>>>>>> Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/
>>>>>>>>> tree/b9522976
>>>>>>>>> Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/
>>>>>>>>> diff/b9522976
>>>>>>>>>
>>>>>>>>> Branch: refs/heads/master
>>>>>>>>> Commit: b9522976f462687b0693b7229ba5c7faee0cb74b
>>>>>>>>> Parents: 641aa1c
>>>>>>>>> Author: Kavuri, Vamsi <[hidden email]>
>>>>>>>>> Authored: Sat Oct 14 12:30:35 2017 -0400
>>>>>>>>> Committer: pascalschumacher <[hidden email]>
>>>>>>>>> Committed: Sat Oct 14 18:52:04 2017 +0200
>>>>>>>>>
>>>>>>>>> ------------------------------------------------------------
>>>>> ----------
>>>>>>>>>      .../commons/collections4/MapUtilsTest.java      | 110
>>>>>>>>>
>>>>>>>> +++++++++----------
>>>>>>>>
>>>>>>>>>      1 file changed, 55 insertions(+), 55 deletions(-)
>>>>>>>>> ------------------------------------------------------------
>>>>> ----------
>>>>>>>>> http://git-wip-us.apache.org/repos/asf/commons-collections/
>>>>>>>>> blob/b9522976/src/test/java/org/apache/commons/
>>>>>>>>> collections4/MapUtilsTest.java
>>>>>>>>> ------------------------------------------------------------
>>>>> ----------
>>>>>>>>> diff --git
>>>>>>>>>
>>>>>>>> a/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
>>>>>>>>
>>>>>>>>> b/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
>>>>>>>>> index fc3e3d6..21f20c4 100644
>>>>>>>>> --- a/src/test/java/org/apache/commons/collections4/MapUtilsTest
>>>> .java
>>>>>>>>> +++ b/src/test/java/org/apache/commons/collections4/MapUtilsTest
>>>> .java
>>>>>>>>> @@ -950,12 +950,12 @@ public class MapUtilsTest extends
>>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>>              final Map<String, Double> in = new HashMap<>();
>>>>>>>>>              in.put("key", 2.0);
>>>>>>>>>
>>>>>>>>> -        assertEquals(MapUtils.getDoubleValue(in,"key", 0.0), 2.0,
>>>>> 0);
>>>>>>>>> -        assertEquals(MapUtils.getDoubleValue(in,"key"), 2.0, 0);
>>>>>>>>> -        assertEquals(MapUtils.getDoubleValue(in,"noKey", 1.0),
>>>> 1.0,
>>>>>>>>> 0);
>>>>>>>>> -        assertEquals(MapUtils.getDoubleValue(in,"noKey"), 0, 0);
>>>>>>>>> -        assertEquals(MapUtils.getDouble(in,"key", 0.0), 2.0, 0);
>>>>>>>>> -        assertEquals(MapUtils.getDouble(in,"noKey", 1.0), 1.0,
>>>> 0);
>>>>>>>>> +        assertEquals(2.0, MapUtils.getDoubleValue(in,"key", 0.0),
>>>>> 0);
>>>>>>>>> +        assertEquals(2.0, MapUtils.getDoubleValue(in,"key"), 0);
>>>>>>>>> +        assertEquals(1.0, MapUtils.getDoubleValue(in,"noKey",
>>>> 1.0),
>>>>>>>>> 0);
>>>>>>>>> +        assertEquals(0, MapUtils.getDoubleValue(in,"noKey"), 0);
>>>>>>>>> +        assertEquals(2.0, MapUtils.getDouble(in,"key", 0.0), 0);
>>>>>>>>> +        assertEquals(1.0, MapUtils.getDouble(in,"noKey", 1.0), 0);
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>              final Map<String, String> inStr = new HashMap<>();
>>>>>>>>> @@ -970,12 +970,12 @@ public class MapUtilsTest extends
>>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>>              final Map<String, Float> in = new HashMap<>();
>>>>>>>>>              in.put("key", 2.0f);
>>>>>>>>>
>>>>>>>>> -        assertEquals(MapUtils.getFloatValue(in,"key", 0.0f), 2.0,
>>>>> 0);
>>>>>>>>> -        assertEquals(MapUtils.getFloatValue(in,"key"), 2.0, 0);
>>>>>>>>> -        assertEquals(MapUtils.getFloatValue(in,"noKey", 1.0f),
>>>> 1.0,
>>>>>>>>> 0);
>>>>>>>>> -        assertEquals(MapUtils.getFloatValue(in,"noKey"), 0, 0);
>>>>>>>>> -        assertEquals(MapUtils.getFloat(in,"key", 0.0f), 2.0, 0);
>>>>>>>>> -        assertEquals(MapUtils.getFloat(in,"noKey", 1.0f), 1.0,
>>>> 0);
>>>>>>>>> +        assertEquals(2.0, MapUtils.getFloatValue(in,"key", 0.0f),
>>>>> 0);
>>>>>>>>> +        assertEquals(2.0, MapUtils.getFloatValue(in,"key"), 0);
>>>>>>>>> +        assertEquals(1.0, MapUtils.getFloatValue(in,"noKey",
>>>> 1.0f),
>>>>>>>>> 0);
>>>>>>>>> +        assertEquals(0, MapUtils.getFloatValue(in,"noKey"), 0);
>>>>>>>>> +        assertEquals(2.0, MapUtils.getFloat(in,"key", 0.0f), 0);
>>>>>>>>> +        assertEquals(1.0, MapUtils.getFloat(in,"noKey", 1.0f), 0);
>>>>>>>>>
>>>>>>>>>              final Map<String, String> inStr = new HashMap<>();
>>>>>>>>>              char decimalSeparator = getDecimalSeparator();
>>>>>>>>> @@ -989,12 +989,12 @@ public class MapUtilsTest extends
>>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>>              final Map<String, Long> in = new HashMap<>();
>>>>>>>>>              in.put("key", 2L);
>>>>>>>>>
>>>>>>>>> -        assertEquals(MapUtils.getLongValue(in,"key", 0L), 2.0,
>>>> 0);
>>>>>>>>> -        assertEquals(MapUtils.getLongValue(in,"key"), 2.0, 0);
>>>>>>>>> -        assertEquals(MapUtils.getLongValue(in,"noKey", 1L), 1,
>>>> 0);
>>>>>>>>> -        assertEquals(MapUtils.getLongValue(in,"noKey"), 0, 0);
>>>>>>>>> -        assertEquals(MapUtils.getLong(in,"key", 0L), 2.0, 0);
>>>>>>>>> -        assertEquals(MapUtils.getLong(in,"noKey", 1L), 1, 0);
>>>>>>>>> +        assertEquals(2.0, MapUtils.getLongValue(in,"key", 0L),
>>>> 0);
>>>>>>>>> +        assertEquals(2.0, MapUtils.getLongValue(in,"key"), 0);
>>>>>>>>> +        assertEquals(1, MapUtils.getLongValue(in,"noKey", 1L),
>>>> 0);
>>>>>>>>> +        assertEquals(0, MapUtils.getLongValue(in,"noKey"), 0);
>>>>>>>>> +        assertEquals(2.0, MapUtils.getLong(in,"key", 0L), 0);
>>>>>>>>> +        assertEquals(1, MapUtils.getLong(in,"noKey", 1L), 0);
>>>>>>>>>
>>>>>>>>>              final Map<String, String> inStr = new HashMap<>();
>>>>>>>>>              inStr.put("str1", "2");
>>>>>>>>> @@ -1009,12 +1009,12 @@ public class MapUtilsTest extends
>>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>>              final Map<String, Integer> in = new HashMap<>();
>>>>>>>>>              in.put("key", 2);
>>>>>>>>>
>>>>>>>>> -        assertEquals(MapUtils.getIntValue(in,"key", 0), 2, 0);
>>>>>>>>> -        assertEquals(MapUtils.getIntValue(in,"key"), 2, 0);
>>>>>>>>> -        assertEquals(MapUtils.getIntValue(in,"noKey", 0), 0, 0);
>>>>>>>>> -        assertEquals(MapUtils.getIntValue(in,"noKey"), 0, 0);
>>>>>>>>> -        assertEquals(MapUtils.getInteger(in,"key", 0), 2, 0);
>>>>>>>>> -        assertEquals(MapUtils.getInteger(in,"noKey", 0), 0, 0);
>>>>>>>>> +        assertEquals(2, MapUtils.getIntValue(in,"key", 0), 0);
>>>>>>>>> +        assertEquals(2, MapUtils.getIntValue(in,"key"), 0);
>>>>>>>>> +        assertEquals(0, MapUtils.getIntValue(in,"noKey", 0), 0);
>>>>>>>>> +        assertEquals(0, MapUtils.getIntValue(in,"noKey"), 0);
>>>>>>>>> +        assertEquals(2, MapUtils.getInteger(in,"key", 0), 0);
>>>>>>>>> +        assertEquals(0, MapUtils.getInteger(in,"noKey", 0), 0);
>>>>>>>>>
>>>>>>>>>              final Map<String, String> inStr = new HashMap<>();
>>>>>>>>>              inStr.put("str1", "2");
>>>>>>>>> @@ -1028,12 +1028,12 @@ public class MapUtilsTest extends
>>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>>              final short val = 10;
>>>>>>>>>              in.put("key", val);
>>>>>>>>>
>>>>>>>>> -        assertEquals(MapUtils.getShortValue(in,"key", val), val,
>>>> 0);
>>>>>>>>> -        assertEquals(MapUtils.getShortValue(in,"key"), val, 0);
>>>>>>>>> -        assertEquals(MapUtils.getShortValue(in,"noKey", val),
>>>> val,
>>>>> 0);
>>>>>>>>> -        assertEquals(MapUtils.getShortValue(in,"noKey"), 0, 0);
>>>>>>>>> -        assertEquals(MapUtils.getShort(in,"key", val), val, 0);
>>>>>>>>> -        assertEquals(MapUtils.getShort(in,"noKey", val), val, 0);
>>>>>>>>> +        assertEquals(val, MapUtils.getShortValue(in,"key", val),
>>>> 0);
>>>>>>>>> +        assertEquals(val, MapUtils.getShortValue(in,"key"), 0);
>>>>>>>>> +        assertEquals(val, MapUtils.getShortValue(in,"noKey",
>>>> val),
>>>>> 0);
>>>>>>>>> +        assertEquals(0, MapUtils.getShortValue(in,"noKey"), 0);
>>>>>>>>> +        assertEquals(val, MapUtils.getShort(in,"key", val), 0);
>>>>>>>>> +        assertEquals(val,MapUtils.getShort(in,"noKey", val), 0);
>>>>>>>>>
>>>>>>>>>              final Map<String, String> inStr = new HashMap<>();
>>>>>>>>>              inStr.put("str1", "10");
>>>>>>>>> @@ -1047,12 +1047,12 @@ public class MapUtilsTest extends
>>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>>              final byte val = 100;
>>>>>>>>>              in.put("key", val);
>>>>>>>>>
>>>>>>>>> -        assertEquals(MapUtils.getByteValue(in,"key", val), val,
>>>> 0);
>>>>>>>>> -        assertEquals(MapUtils.getByteValue(in,"key"), val, 0);
>>>>>>>>> -        assertEquals(MapUtils.getByteValue(in,"noKey", val), val,
>>>>> 0);
>>>>>>>>> -        assertEquals(MapUtils.getByteValue(in,"noKey"), 0, 0);
>>>>>>>>> -        assertEquals(MapUtils.getByte(in,"key", val), val, 0);
>>>>>>>>> -        assertEquals(MapUtils.getByte(in,"noKey", val), val, 0);
>>>>>>>>> +        assertEquals(val, MapUtils.getByteValue(in,"key", val),
>>>> 0);
>>>>>>>>> +        assertEquals(val, MapUtils.getByteValue(in,"key"), 0);
>>>>>>>>> +        assertEquals(val, MapUtils.getByteValue(in,"noKey", val),
>>>>> 0);
>>>>>>>>> +        assertEquals(0, MapUtils.getByteValue(in,"noKey"), 0);
>>>>>>>>> +        assertEquals(val, MapUtils.getByte(in,"key", val), 0);
>>>>>>>>> +        assertEquals(val, MapUtils.getByte(in,"noKey", val), 0);
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>              final Map<String, String> inStr = new HashMap<>();
>>>>>>>>> @@ -1067,8 +1067,8 @@ public class MapUtilsTest extends
>>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>>              final Number val = 1000;
>>>>>>>>>              in.put("key", val);
>>>>>>>>>
>>>>>>>>> -        assertEquals(MapUtils.getNumber(in,"key",
>>>> val).intValue(),
>>>>>>>>> val.intValue(), 0);
>>>>>>>>> -        assertEquals(MapUtils.getNumber(in,"noKey",
>>>> val).intValue(),
>>>>>>>>> val.intValue(), 0);
>>>>>>>>> +        assertEquals(val.intValue(), MapUtils.getNumber(in,"key",
>>>>>>>>> val).intValue(), 0);
>>>>>>>>> +        assertEquals(val.intValue(),
>>>> MapUtils.getNumber(in,"noKey",
>>>>>>>>> val).intValue(), 0);
>>>>>>>>>
>>>>>>>>>          }
>>>>>>>>>
>>>>>>>>> @@ -1077,11 +1077,11 @@ public class MapUtilsTest extends
>>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>>              final Map<String, String> in = new HashMap<>();
>>>>>>>>>              in.put("key", "str");
>>>>>>>>>
>>>>>>>>> -        assertEquals(MapUtils.getString(in,"key", "defualt"),
>>>>> "str");
>>>>>>>>> -        assertEquals(MapUtils.getString(in,"key"), "str");
>>>>>>>>> -        assertEquals(MapUtils.getString(null,"key"), null);
>>>>>>>>> -        assertEquals(MapUtils.getString(in,"noKey", "default"),
>>>>>>>>> "default");
>>>>>>>>> -        assertEquals(MapUtils.getString(null,"noKey", "default"),
>>>>>>>>> "default");
>>>>>>>>> +        assertEquals("str", MapUtils.getString(in,"key",
>>>> "defualt"));
>>>>>>>>> +        assertEquals("str", MapUtils.getString(in,"key"));
>>>>>>>>> +        assertEquals(null, MapUtils.getString(null,"key"));
>>>>>>>>> +        assertEquals("default", MapUtils.getString(in,"noKey",
>>>>>>>>> "default"));
>>>>>>>>> +        assertEquals("default", MapUtils.getString(null,"noKey",
>>>>>>>>> "default"));
>>>>>>>>>
>>>>>>>>>          }
>>>>>>>>>
>>>>>>>>> @@ -1090,11 +1090,11 @@ public class MapUtilsTest extends
>>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>>              final Map<String, Object> in = new HashMap<>();
>>>>>>>>>              in.put("key", "str");
>>>>>>>>>
>>>>>>>>> -        assertEquals(MapUtils.getObject(in,"key", "defualt"),
>>>>> "str");
>>>>>>>>> -        assertEquals(MapUtils.getObject(in,"key"), "str");
>>>>>>>>> -        assertEquals(MapUtils.getObject(null,"key"), null);
>>>>>>>>> -        assertEquals(MapUtils.getObject(in,"noKey", "default"),
>>>>>>>>> "default");
>>>>>>>>> -        assertEquals(MapUtils.getObject(null,"noKey", "default"),
>>>>>>>>> "default");
>>>>>>>>> +        assertEquals("str", MapUtils.getObject(in,"key",
>>>> "defualt"));
>>>>>>>>> +        assertEquals("str", MapUtils.getObject(in,"key"));
>>>>>>>>> +        assertEquals(null, MapUtils.getObject(null,"key"));
>>>>>>>>> +        assertEquals("default", MapUtils.getObject(in,"noKey",
>>>>>>>>> "default"));
>>>>>>>>> +        assertEquals("default", MapUtils.getObject(null,"noKey",
>>>>>>>>> "default"));
>>>>>>>>>
>>>>>>>>>          }
>>>>>>>>>
>>>>>>>>> @@ -1109,7 +1109,7 @@ public class MapUtilsTest extends
>>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>>              assertTrue(!MapUtils.getBooleanValue(in,"noKey"));
>>>>>>>>>              assertTrue(MapUtils.getBoolean(in,"key", true));
>>>>>>>>>              assertTrue(MapUtils.getBoolean(in,"noKey", true));
>>>>>>>>> -        assertEquals(MapUtils.getBoolean(null,"noKey"),null);
>>>>>>>>> +        assertEquals(null, MapUtils.getBoolean(null,"noKey"));
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> @@ -1130,10 +1130,10 @@ public class MapUtilsTest extends
>>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>>              in.put("key1", valMap);
>>>>>>>>>              final Map<?, ?> outValue =  MapUtils.getMap(in,"key1",
>>>>> null);
>>>>>>>>> -        assertEquals( outValue.get("key1"), "value1");
>>>>>>>>> -        assertEquals( outValue.get("key2"), null);
>>>>>>>>> -        assertEquals( MapUtils.getMap(in,"key2", null), null);
>>>>>>>>> -        assertEquals( MapUtils.getMap(null,"key2", null), null);
>>>>>>>>> +        assertEquals("value1", outValue.get("key1"));
>>>>>>>>> +        assertEquals(null, outValue.get("key2"));
>>>>>>>>> +        assertEquals(null, MapUtils.getMap(in,"key2", null));
>>>>>>>>> +        assertEquals(null, MapUtils.getMap(null,"key2", null));
>>>>>>>>>          }
>>>>>>>>>
>>>>>>>>>          @Test
>>>>>>>>> @@ -1143,8 +1143,8 @@ public class MapUtilsTest extends
>>>>>>>>> AbstractAvailableLocalesTest {
>>>>>>>>>
>>>>>>>>>              MapUtils.safeAddToMap(inMap,"key1", "value1");
>>>>>>>>>              MapUtils.safeAddToMap(inMap,"key2", null);
>>>>>>>>> -        assertEquals( inMap.get("key1"), "value1");
>>>>>>>>> -        assertEquals( inMap.get("key2"), "");
>>>>>>>>> +        assertEquals("value1", inMap.get("key1"));
>>>>>>>>> +        assertEquals("", inMap.get("key2"));
>>>>>>>>>          }
>>>>>>>>>
>>>>>>>>>          @Test
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: [hidden email]
>>>>>> For additional commands, e-mail: [hidden email]
>>>>>>
>>>>>>
>>>>
>>>> --
>>>> Matt Sicker <[hidden email]>
>>>>
>
>
>   



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]