diff options
author | XenoAmess <xenoamess@gmail.com> | 2020-06-14 06:33:29 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-13 18:33:29 -0400 |
commit | 797d550a92d7df12ebc83e3c5e3fafa61a2a8ce3 (patch) | |
tree | 5f09616a538d44b0d71e30fbfee5f8f51f65c27c /src/test/java/org/apache | |
parent | 78c1c7f9ab79cbdb8fe4469e41858a9308257cda (diff) | |
download | apache-commons-lang-797d550a92d7df12ebc83e3c5e3fafa61a2a8ce3.tar.gz |
[LANG-1556] Use Java 8 lambdas and Map operations. (#541)
* java8
* refine
* rebase
Diffstat (limited to 'src/test/java/org/apache')
-rw-r--r-- | src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java | 2 | ||||
-rw-r--r-- | src/test/java/org/apache/commons/lang3/FunctionsTest.java | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java b/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java index db9b5abb6..78d61f0a7 100644 --- a/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java @@ -1499,7 +1499,7 @@ public class ArrayUtilsTest { @Test public void testIsSortedComparator() { - final Comparator<Integer> c = (o1, o2) -> o2.compareTo(o1); + final Comparator<Integer> c = Comparator.reverseOrder(); Integer[] array = null; assertTrue(ArrayUtils.isSorted(array, c)); diff --git a/src/test/java/org/apache/commons/lang3/FunctionsTest.java b/src/test/java/org/apache/commons/lang3/FunctionsTest.java index 51699c225..3a4128b02 100644 --- a/src/test/java/org/apache/commons/lang3/FunctionsTest.java +++ b/src/test/java/org/apache/commons/lang3/FunctionsTest.java @@ -579,7 +579,7 @@ class FunctionsTest { FailureOnOddInvocations.invocations = 0; final FailableCallable<FailureOnOddInvocations, SomeException> failableCallable = FailureOnOddInvocations::new; final Callable<FailureOnOddInvocations> callable = Functions.asCallable(failableCallable); - final UndeclaredThrowableException e = assertThrows(UndeclaredThrowableException.class, () -> callable.call()); + final UndeclaredThrowableException e = assertThrows(UndeclaredThrowableException.class, callable::call); final Throwable cause = e.getCause(); assertNotNull(cause); assertTrue(cause instanceof SomeException); @@ -663,7 +663,7 @@ class FunctionsTest { void testAsRunnable() { FailureOnOddInvocations.invocations = 0; final Runnable runnable = Functions.asRunnable(FailureOnOddInvocations::new); - final UndeclaredThrowableException e = assertThrows(UndeclaredThrowableException.class, () -> runnable.run()); + final UndeclaredThrowableException e = assertThrows(UndeclaredThrowableException.class, runnable::run); final Throwable cause = e.getCause(); assertNotNull(cause); assertTrue(cause instanceof SomeException); @@ -678,7 +678,7 @@ class FunctionsTest { FailureOnOddInvocations.invocations = 0; final FailableSupplier<FailureOnOddInvocations, Throwable> failableSupplier = FailureOnOddInvocations::new; final Supplier<FailureOnOddInvocations> supplier = Functions.asSupplier(failableSupplier); - final UndeclaredThrowableException e = assertThrows(UndeclaredThrowableException.class, () -> supplier.get()); + final UndeclaredThrowableException e = assertThrows(UndeclaredThrowableException.class, supplier::get); final Throwable cause = e.getCause(); assertNotNull(cause); assertTrue(cause instanceof SomeException); |