You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/06/27 15:01:55 UTC

[commons-text] branch master updated: Simplify tests by reusing factory method.

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-text.git


The following commit(s) were added to refs/heads/master by this push:
     new 1c964bc  Simplify tests by reusing factory method.
1c964bc is described below

commit 1c964bc580be4f72e50d418a6d03dc5768e3b24f
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Jun 27 11:01:49 2020 -0400

    Simplify tests by reusing factory method.
---
 .../org/apache/commons/text/lookup/FunctionStringLookupTest.java  | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/test/java/org/apache/commons/text/lookup/FunctionStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/FunctionStringLookupTest.java
index 1673096..1ae122e 100644
--- a/src/test/java/org/apache/commons/text/lookup/FunctionStringLookupTest.java
+++ b/src/test/java/org/apache/commons/text/lookup/FunctionStringLookupTest.java
@@ -31,14 +31,12 @@ public class FunctionStringLookupTest {
 
     @Test
     public void testConcurrentHashMapNull() {
-        final Map<String, Object> map = new ConcurrentHashMap<>();
-        Assertions.assertNull(FunctionStringLookup.on(k -> map.get(k)).lookup(null));
+        Assertions.assertNull(FunctionStringLookup.on(new ConcurrentHashMap<>()).lookup(null));
     }
 
     @Test
     public void testHashMapNull() {
-        final Map<String, Object> map = new HashMap<>();
-        Assertions.assertNull(FunctionStringLookup.on(k -> map.get(k)).lookup(null));
+        Assertions.assertNull(FunctionStringLookup.on(new HashMap<>()).lookup(null));
     }
 
     @Test
@@ -47,7 +45,7 @@ public class FunctionStringLookupTest {
         final String value = "value";
         final Map<String, String> map = new HashMap<>();
         map.put(key, value);
-        Assertions.assertEquals(value, FunctionStringLookup.on(k -> map.get(k)).lookup(key));
+        Assertions.assertEquals(value, FunctionStringLookup.on(map).lookup(key));
     }
 
 }