You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2018/01/22 21:23:23 UTC

[isis] branch ISIS-1846_internal_utils updated (463947d -> dd3029c)

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

ahuber pushed a change to branch ISIS-1846_internal_utils
in repository https://gitbox.apache.org/repos/asf/isis.git.


    from 463947d  ISIS-1846 fix Enums copy paste error
     new 62c3f3b  ISIS-1827 added tests for all ExceptionRecognizers to reflect applib additions
     new dd3029c  ISIS-1827 mark some unused public static guava functions deprecated

The 2 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:
 .../layout/component/CollectionLayoutData.java     |  3 +-
 .../isis/applib/layout/component/FieldSet.java     |  2 +-
 ...t.java => ExceptionRecognizerForType2Test.java} | 12 ++++----
 .../exceprecog/ExceptionRecognizerGeneralTest.java | 32 ++++++++++++++++++----
 4 files changed, 34 insertions(+), 15 deletions(-)
 copy core/applib/src/test/java/org/apache/isis/applib/services/exceprecog/{ExceptionRecognizerForTypeTest.java => ExceptionRecognizerForType2Test.java} (84%)

-- 
To stop receiving notification emails like this one, please contact
ahuber@apache.org.

[isis] 02/02: ISIS-1827 mark some unused public static guava functions deprecated

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

ahuber pushed a commit to branch ISIS-1846_internal_utils
in repository https://gitbox.apache.org/repos/asf/isis.git

commit dd3029cd7ba333d7d8217a6a0ad323f5253ddba4
Author: Andi Huber <ah...@apache.org>
AuthorDate: Mon Jan 22 22:23:22 2018 +0100

    ISIS-1827 mark some unused public static guava functions deprecated
---
 .../org/apache/isis/applib/layout/component/CollectionLayoutData.java  | 3 +--
 .../main/java/org/apache/isis/applib/layout/component/FieldSet.java    | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/component/CollectionLayoutData.java b/core/applib/src/main/java/org/apache/isis/applib/layout/component/CollectionLayoutData.java
index 26fc325..730d0a6 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/component/CollectionLayoutData.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/component/CollectionLayoutData.java
@@ -266,8 +266,7 @@ public class CollectionLayoutData
         this.link = link;
     }
 
-
-
+    @Deprecated //[ahuber] not used, or otherwise replace with java 8+ function variant
     public static class Functions {
         private Functions(){}
 
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/component/FieldSet.java b/core/applib/src/main/java/org/apache/isis/applib/layout/component/FieldSet.java
index 2cb3be1..0f04033 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/component/FieldSet.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/component/FieldSet.java
@@ -201,7 +201,7 @@ public class FieldSet
     }
 
 
-
+    @Deprecated //[ahuber] not used, or otherwise replace with java 8+ function variant
     public static class Util {
         private Util(){}
         public static Function<? super FieldSet, String> nameOf() {

-- 
To stop receiving notification emails like this one, please contact
ahuber@apache.org.

[isis] 01/02: ISIS-1827 added tests for all ExceptionRecognizers to reflect applib additions

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

ahuber pushed a commit to branch ISIS-1846_internal_utils
in repository https://gitbox.apache.org/repos/asf/isis.git

commit 62c3f3b353054998359aa15488f984c50878ec57
Author: Andi Huber <ah...@apache.org>
AuthorDate: Mon Jan 22 22:20:26 2018 +0100

    ISIS-1827 added tests for all ExceptionRecognizers to reflect applib
    additions
---
 ...t.java => ExceptionRecognizerForType2Test.java} | 29 ++++++++++++--------
 .../exceprecog/ExceptionRecognizerGeneralTest.java | 32 ++++++++++++++++++----
 2 files changed, 43 insertions(+), 18 deletions(-)

diff --git a/core/applib/src/test/java/org/apache/isis/applib/services/exceprecog/ExceptionRecognizerGeneralTest.java b/core/applib/src/test/java/org/apache/isis/applib/services/exceprecog/ExceptionRecognizerForType2Test.java
similarity index 68%
copy from core/applib/src/test/java/org/apache/isis/applib/services/exceprecog/ExceptionRecognizerGeneralTest.java
copy to core/applib/src/test/java/org/apache/isis/applib/services/exceprecog/ExceptionRecognizerForType2Test.java
index 239e59c..c541001 100644
--- a/core/applib/src/test/java/org/apache/isis/applib/services/exceprecog/ExceptionRecognizerGeneralTest.java
+++ b/core/applib/src/test/java/org/apache/isis/applib/services/exceprecog/ExceptionRecognizerForType2Test.java
@@ -23,20 +23,26 @@ import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.CoreMatchers.nullValue;
 import static org.junit.Assert.assertThat;
 
-import com.google.common.base.Function;
-import com.google.common.base.Predicates;
+import java.util.function.Function;
 
 import org.junit.Test;
 
-public class ExceptionRecognizerGeneralTest {
+public class ExceptionRecognizerForType2Test {
 
-    private ExceptionRecognizerAbstract ersGeneral;
+    private ExceptionRecognizerForType2 ersForType;
 
     static class FooException extends Exception {
         private static final long serialVersionUID = 1L;
         public FooException() {
             super("foo");
         }
+        
+    }
+    static class BarException extends Exception {
+        private static final long serialVersionUID = 1L;
+        public BarException() {
+            super("bar");
+        }
     }
     
     private Function<String,String> prepend = new Function<String, String>() {
@@ -45,24 +51,23 @@ public class ExceptionRecognizerGeneralTest {
             return "pre: " + input;
         }
     };
-    
-    
+
     @Test
     public void whenRecognized() {
-        ersGeneral = new ExceptionRecognizerAbstract(Predicates.<Throwable>alwaysTrue()){};
-        assertThat(ersGeneral.recognize(new FooException()), is("foo"));
+        ersForType = new ExceptionRecognizerForType2(FooException.class);
+        assertThat(ersForType.recognize(new FooException()), is("foo"));
     }
 
     @Test
     public void whenDoesNotRecognize() {
-        ersGeneral = new ExceptionRecognizerAbstract(Predicates.<Throwable>alwaysFalse()){};
-        assertThat(ersGeneral.recognize(new FooException()), is(nullValue()));
+        ersForType = new ExceptionRecognizerForType2(FooException.class);
+        assertThat(ersForType.recognize(new BarException()), is(nullValue()));
     }
 
     @Test
     public void whenRecognizedWithMessageParser() {
-        ersGeneral = new ExceptionRecognizerAbstract(Predicates.<Throwable>alwaysTrue(), prepend){};
-        assertThat(ersGeneral.recognize(new FooException()), is("pre: foo"));
+        ersForType = new ExceptionRecognizerForType2(FooException.class, prepend);
+        assertThat(ersForType.recognize(new FooException()), is("pre: foo"));
     }
 
 }
diff --git a/core/applib/src/test/java/org/apache/isis/applib/services/exceprecog/ExceptionRecognizerGeneralTest.java b/core/applib/src/test/java/org/apache/isis/applib/services/exceprecog/ExceptionRecognizerGeneralTest.java
index 239e59c..a2a0118 100644
--- a/core/applib/src/test/java/org/apache/isis/applib/services/exceprecog/ExceptionRecognizerGeneralTest.java
+++ b/core/applib/src/test/java/org/apache/isis/applib/services/exceprecog/ExceptionRecognizerGeneralTest.java
@@ -23,8 +23,7 @@ import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.CoreMatchers.nullValue;
 import static org.junit.Assert.assertThat;
 
-import com.google.common.base.Function;
-import com.google.common.base.Predicates;
+import java.util.function.Predicate;
 
 import org.junit.Test;
 
@@ -39,7 +38,7 @@ public class ExceptionRecognizerGeneralTest {
         }
     }
     
-    private Function<String,String> prepend = new Function<String, String>() {
+    private com.google.common.base.Function<String,String> prepend = new com.google.common.base.Function<String, String>() {
         @Override
         public String apply(String input) {
             return "pre: " + input;
@@ -48,20 +47,41 @@ public class ExceptionRecognizerGeneralTest {
     
     
     @Test
+    public void whenRecognized_guava() {
+        ersGeneral = new ExceptionRecognizerAbstract(com.google.common.base.Predicates.<Throwable>alwaysTrue()){};
+        assertThat(ersGeneral.recognize(new FooException()), is("foo"));
+    }
+
+    @Test
+    public void whenDoesNotRecognize_guava() {
+        ersGeneral = new ExceptionRecognizerAbstract(com.google.common.base.Predicates.<Throwable>alwaysFalse()){};
+        assertThat(ersGeneral.recognize(new FooException()), is(nullValue()));
+    }
+
+    @Test
+    public void whenRecognizedWithMessageParser_guava() {
+        ersGeneral = new ExceptionRecognizerAbstract(com.google.common.base.Predicates.<Throwable>alwaysTrue(), prepend){};
+        assertThat(ersGeneral.recognize(new FooException()), is("pre: foo"));
+    }
+    
+    private final static Predicate<Throwable> ALWAYS_TRUE = __->true;
+    private final static Predicate<Throwable> ALWAYS_FALSE = __->false;
+    
+    @Test
     public void whenRecognized() {
-        ersGeneral = new ExceptionRecognizerAbstract(Predicates.<Throwable>alwaysTrue()){};
+        ersGeneral = new ExceptionRecognizerAbstract(ALWAYS_TRUE){};
         assertThat(ersGeneral.recognize(new FooException()), is("foo"));
     }
 
     @Test
     public void whenDoesNotRecognize() {
-        ersGeneral = new ExceptionRecognizerAbstract(Predicates.<Throwable>alwaysFalse()){};
+        ersGeneral = new ExceptionRecognizerAbstract(ALWAYS_FALSE){};
         assertThat(ersGeneral.recognize(new FooException()), is(nullValue()));
     }
 
     @Test
     public void whenRecognizedWithMessageParser() {
-        ersGeneral = new ExceptionRecognizerAbstract(Predicates.<Throwable>alwaysTrue(), prepend){};
+        ersGeneral = new ExceptionRecognizerAbstract(ALWAYS_TRUE, s->"pre: " + s){};
         assertThat(ersGeneral.recognize(new FooException()), is("pre: foo"));
     }
 

-- 
To stop receiving notification emails like this one, please contact
ahuber@apache.org.