Use final, valueOf(), lambdas.

This commit is contained in:
Gary Gregory 2021-09-01 11:04:21 -04:00
parent 7f7c3d63c8
commit 5a580fb9cb
6 changed files with 9 additions and 12 deletions

View File

@ -36,7 +36,7 @@ public class ArrayUtilsSetTest {
assertArrayEquals(null, ArrayUtils.setAll(null, nullIntFunction));
assertArrayEquals(ArrayUtils.EMPTY_BOOLEAN_OBJECT_ARRAY, ArrayUtils.setAll(ArrayUtils.EMPTY_BOOLEAN_OBJECT_ARRAY, nullIntFunction));
assertArrayEquals(ArrayUtils.EMPTY_OBJECT_ARRAY, ArrayUtils.setAll(ArrayUtils.EMPTY_OBJECT_ARRAY, nullIntFunction));
Integer[] array = new Integer[10];
final Integer[] array = new Integer[10];
final Integer[] array2 = ArrayUtils.setAll(array, Integer::valueOf);
assertSame(array, array2);
for (int i = 0; i < array.length; i++) {
@ -51,10 +51,10 @@ public class ArrayUtilsSetTest {
assertArrayEquals(null, ArrayUtils.setAll(null, nullSupplier));
assertArrayEquals(ArrayUtils.EMPTY_BOOLEAN_OBJECT_ARRAY, ArrayUtils.setAll(ArrayUtils.EMPTY_BOOLEAN_OBJECT_ARRAY, nullSupplier));
assertArrayEquals(ArrayUtils.EMPTY_OBJECT_ARRAY, ArrayUtils.setAll(ArrayUtils.EMPTY_OBJECT_ARRAY, nullSupplier));
String[] array = new String[10];
final String[] array = new String[10];
final String[] array2 = ArrayUtils.setAll(array, () -> StringUtils.EMPTY);
assertSame(array, array2);
for (String s : array) {
for (final String s : array) {
assertEquals(StringUtils.EMPTY, s);
}
}

View File

@ -27,7 +27,7 @@ public class UncheckedExecutionExceptionTest {
@Test
public void testConstructWithCause() {
Exception e = new Exception();
final Exception e = new Exception();
assertSame(e, new UncheckedExecutionException(e).getCause());
}

View File

@ -27,7 +27,7 @@ public class UncheckedTimeoutExceptionTest {
@Test
public void testConstructWithCause() {
Exception e = new Exception();
final Exception e = new Exception();
assertSame(e, new UncheckedTimeoutException(e).getCause());
}

View File

@ -27,7 +27,7 @@ public class UncheckedExceptionTest {
@Test
public void testConstructWithCause() {
Exception e = new Exception();
final Exception e = new Exception();
assertSame(e, new UncheckedException(e).getCause());
}

View File

@ -27,7 +27,7 @@ public class UncheckedInterruptedExceptionTest {
@Test
public void testConstructWithCause() {
Exception e = new Exception();
final Exception e = new Exception();
assertSame(e, new UncheckedInterruptedException(e).getCause());
}

View File

@ -66,11 +66,8 @@ public class BooleanConsumerTest {
assertFalse(aBool2.get());
// Check order
final BooleanConsumer bad = new BooleanConsumer() {
@Override
public void accept(boolean value) {
throw new IllegalStateException();
}
final BooleanConsumer bad = value -> {
throw new IllegalStateException();
};
final BooleanConsumer badComposite = bad.andThen(aBool2::lazySet);