You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ki...@apache.org on 2021/04/18 20:55:00 UTC

[commons-text] branch master updated (dd87e11 -> f658d9d)

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

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


    from dd87e11  Merge branch 'pr-221'
     new eae283d  [TEXT-198] Replace lambda with method reference
     new ba25892  [TEXT-198] Changelog
     new f658d9d  Merge branch 'pr-220'

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/changes/changes.xml                                           | 1 +
 src/test/java/org/apache/commons/text/StrTokenizerTest.java       | 8 ++++----
 .../text/StringSubstitutorWithInterpolatorStringLookupTest.java   | 2 +-
 src/test/java/org/apache/commons/text/StringTokenizerTest.java    | 8 ++++----
 .../java/org/apache/commons/text/lookup/BiStringLookupTest.java   | 8 +-------
 5 files changed, 11 insertions(+), 16 deletions(-)

[commons-text] 02/03: [TEXT-198] Changelog

Posted by ki...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit ba25892480d0d5137343b96afae3234a72c2e9b9
Author: Bruno P. Kinoshita <ki...@users.noreply.github.com>
AuthorDate: Mon Apr 19 08:54:01 2021 +1200

    [TEXT-198] Changelog
---
 src/changes/changes.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 9b1eaac..e678fb3 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -78,6 +78,7 @@ The <action> type attribute can be add,update,fix,remove.
     <action                  type="update" dev="ggregory" due-to="Gary Gregory">Update commons-lang3 3.11 -> 3.12.0.</action>
     <action issue="TEXT-194" type="update" dev="kinow" due-to="Arturo Bernal">Use StringUtils.INDEX_NOT_FOUND constant.</action>
     <action issue="TEXT-199" type="update" dev="kinow" due-to="Arturo Bernal">Remove redundant local variable.</action>
+    <action issue="TEXT-198" type="update" dev="kinow" due-to="Arturo Bernal"> Replace lambda with method reference.</action>
   </release>
   <release version="1.9" date="2020-07-21" description="Release 1.9. Requires Java 8.">
     <action issue="TEXT-166" type="fix" dev="kinow" due-to="Mikko Maunu">Removed non-existing parameter from Javadocs and spelled out parameters in throws.</action>

[commons-text] 03/03: Merge branch 'pr-220'

Posted by ki...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit f658d9d1083d2f4cdc022a28af01cf663f992423
Merge: dd87e11 ba25892
Author: Bruno P. Kinoshita <ki...@users.noreply.github.com>
AuthorDate: Mon Apr 19 08:54:29 2021 +1200

    Merge branch 'pr-220'
    
    This closes #220

 src/changes/changes.xml                                           | 1 +
 src/test/java/org/apache/commons/text/StrTokenizerTest.java       | 8 ++++----
 .../text/StringSubstitutorWithInterpolatorStringLookupTest.java   | 2 +-
 src/test/java/org/apache/commons/text/StringTokenizerTest.java    | 8 ++++----
 .../java/org/apache/commons/text/lookup/BiStringLookupTest.java   | 8 +-------
 5 files changed, 11 insertions(+), 16 deletions(-)

[commons-text] 01/03: [TEXT-198] Replace lambda with method reference

Posted by ki...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit eae283d5aad5b6a0b128f9ab1fb03119e8ec4703
Author: Arturo Bernal <ar...@gmail.com>
AuthorDate: Sun Apr 18 12:49:00 2021 +0200

    [TEXT-198] Replace lambda with method reference
---
 src/test/java/org/apache/commons/text/StrTokenizerTest.java       | 8 ++++----
 .../text/StringSubstitutorWithInterpolatorStringLookupTest.java   | 2 +-
 src/test/java/org/apache/commons/text/StringTokenizerTest.java    | 8 ++++----
 .../java/org/apache/commons/text/lookup/BiStringLookupTest.java   | 8 +-------
 4 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/src/test/java/org/apache/commons/text/StrTokenizerTest.java b/src/test/java/org/apache/commons/text/StrTokenizerTest.java
index 0e94078..9a2ba6a 100644
--- a/src/test/java/org/apache/commons/text/StrTokenizerTest.java
+++ b/src/test/java/org/apache/commons/text/StrTokenizerTest.java
@@ -724,7 +724,7 @@ public class StrTokenizerTest {
         assertFalse(tokenizer.hasPrevious());
         assertNull(tokenizer.nextToken());
         assertEquals(0, tokenizer.size());
-        assertThrows(NoSuchElementException.class, () -> tokenizer.next());
+        assertThrows(NoSuchElementException.class, tokenizer::next);
     }
 
     @Test
@@ -744,11 +744,11 @@ public class StrTokenizerTest {
     public void testIteration() {
         final StrTokenizer tkn = new StrTokenizer("a b c");
         assertFalse(tkn.hasPrevious());
-        assertThrows(NoSuchElementException.class, () -> tkn.previous());
+        assertThrows(NoSuchElementException.class, tkn::previous);
         assertTrue(tkn.hasNext());
 
         assertEquals("a", tkn.next());
-        assertThrows(UnsupportedOperationException.class, () -> tkn.remove());
+        assertThrows(UnsupportedOperationException.class, tkn::remove);
         assertThrows(UnsupportedOperationException.class, () -> tkn.set("x"));
         assertThrows(UnsupportedOperationException.class, () -> tkn.add("y"));
         assertTrue(tkn.hasPrevious());
@@ -762,7 +762,7 @@ public class StrTokenizerTest {
         assertTrue(tkn.hasPrevious());
         assertFalse(tkn.hasNext());
 
-        assertThrows(NoSuchElementException.class, () -> tkn.next());
+        assertThrows(NoSuchElementException.class, tkn::next);
         assertTrue(tkn.hasPrevious());
         assertFalse(tkn.hasNext());
     }
diff --git a/src/test/java/org/apache/commons/text/StringSubstitutorWithInterpolatorStringLookupTest.java b/src/test/java/org/apache/commons/text/StringSubstitutorWithInterpolatorStringLookupTest.java
index 1d6a16f..996a8de 100644
--- a/src/test/java/org/apache/commons/text/StringSubstitutorWithInterpolatorStringLookupTest.java
+++ b/src/test/java/org/apache/commons/text/StringSubstitutorWithInterpolatorStringLookupTest.java
@@ -41,7 +41,7 @@ public class StringSubstitutorWithInterpolatorStringLookupTest {
         final String value = "value";
         final Map<String, String> map = new HashMap<>();
         map.put(key, value);
-        final StringLookup mapStringLookup = StringLookupFactory.INSTANCE.functionStringLookup(k -> map.get(k));
+        final StringLookup mapStringLookup = StringLookupFactory.INSTANCE.functionStringLookup(map::get);
         final Map<String, StringLookup> stringLookupMap = new HashMap<>();
         stringLookupMap.put("customLookup", mapStringLookup);
         final StringSubstitutor strSubst = new StringSubstitutor(
diff --git a/src/test/java/org/apache/commons/text/StringTokenizerTest.java b/src/test/java/org/apache/commons/text/StringTokenizerTest.java
index 7d1b85d..829ec22 100644
--- a/src/test/java/org/apache/commons/text/StringTokenizerTest.java
+++ b/src/test/java/org/apache/commons/text/StringTokenizerTest.java
@@ -729,7 +729,7 @@ public class StringTokenizerTest {
         assertFalse(tokenizer.hasPrevious());
         assertNull(tokenizer.nextToken());
         assertEquals(0, tokenizer.size());
-        assertThrows(NoSuchElementException.class, () -> tokenizer.next());
+        assertThrows(NoSuchElementException.class, tokenizer::next);
     }
 
     @Test
@@ -749,11 +749,11 @@ public class StringTokenizerTest {
     public void testIteration() {
         final StringTokenizer tkn = new StringTokenizer("a b c");
         assertFalse(tkn.hasPrevious());
-        assertThrows(NoSuchElementException.class, () -> tkn.previous());
+        assertThrows(NoSuchElementException.class, tkn::previous);
         assertTrue(tkn.hasNext());
 
         assertEquals("a", tkn.next());
-        assertThrows(UnsupportedOperationException.class, () -> tkn.remove());
+        assertThrows(UnsupportedOperationException.class, tkn::remove);
         assertThrows(UnsupportedOperationException.class, () -> tkn.set("x"));
         assertThrows(UnsupportedOperationException.class, () -> tkn.add("y"));
         assertTrue(tkn.hasPrevious());
@@ -767,7 +767,7 @@ public class StringTokenizerTest {
         assertTrue(tkn.hasPrevious());
         assertFalse(tkn.hasNext());
 
-        assertThrows(NoSuchElementException.class, () -> tkn.next());
+        assertThrows(NoSuchElementException.class, tkn::next);
         assertTrue(tkn.hasPrevious());
         assertFalse(tkn.hasNext());
     }
diff --git a/src/test/java/org/apache/commons/text/lookup/BiStringLookupTest.java b/src/test/java/org/apache/commons/text/lookup/BiStringLookupTest.java
index 6220fe1..8d54dd5 100644
--- a/src/test/java/org/apache/commons/text/lookup/BiStringLookupTest.java
+++ b/src/test/java/org/apache/commons/text/lookup/BiStringLookupTest.java
@@ -27,13 +27,7 @@ public class BiStringLookupTest {
 
     @Test
     public void testDefaultMethod() {
-        Assertions.assertEquals("a", new BiStringLookup<Object>() {
-
-            @Override
-            public String lookup(final String key) {
-                return key;
-            }
-        }.lookup("a", "b"));
+        Assertions.assertEquals("a", ((BiStringLookup<Object>) key -> key).lookup("a", "b"));
     }
 
 }