Clean up core-java-8 samples

This commit is contained in:
David Morley
2016-04-21 05:19:51 -05:00
parent fa23486f9a
commit 8cbf2e3b88
24 changed files with 50 additions and 299 deletions
@@ -6,7 +6,9 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.util.*;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.function.BiFunction;
import static com.baeldung.doublecolon.ComputerUtils.*;
@@ -1,14 +1,13 @@
package com.baeldung.java8;
import static org.hamcrest.Matchers.hasSize;
import static org.junit.Assert.assertThat;
import com.google.common.collect.Lists;
import org.junit.Test;
import java.util.List;
import java.util.stream.Collectors;
import org.junit.Test;
import com.google.common.collect.Lists;
import static org.hamcrest.Matchers.hasSize;
import static org.junit.Assert.assertThat;
public class Java8CollectionCleanupUnitTest {
@@ -7,6 +7,7 @@ import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.*;
import static org.junit.Assert.*;
@@ -53,8 +54,8 @@ public class Java8ExecutorServiceTest {
public void creationSubmittingTasksShuttingDownNow_whenShutDownAfterAwating_thenCorrect() {
ExecutorService threadPoolExecutor =
new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<>());
new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<>());
for (int i = 0; i < 100; i++) {
threadPoolExecutor.submit(callableTask);
@@ -1,7 +1,6 @@
package com.baeldung.java8;
import com.baeldung.forkjoin.CustomRecursiveAction;
import com.baeldung.forkjoin.CustomRecursiveTask;
import com.baeldung.forkjoin.util.PoolUtil;
@@ -1,16 +1,15 @@
package com.baeldung.java8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import java.util.function.Function;
import org.junit.Before;
import org.junit.Test;
import com.baeldung.Foo;
import com.baeldung.FooExtended;
import com.baeldung.UseFoo;
import org.junit.Before;
import org.junit.Test;
import java.util.function.Function;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
public class Java8FunctionalInteracesLambdasTest {
@@ -1,17 +1,16 @@
package com.baeldung.java8;
import static org.hamcrest.Matchers.equalTo;
import com.baeldung.java8.entity.Human;
import com.google.common.collect.Lists;
import com.google.common.primitives.Ints;
import org.junit.Assert;
import org.junit.Test;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import com.baeldung.java8.entity.Human;
import com.google.common.collect.Lists;
import com.google.common.primitives.Ints;
import static org.hamcrest.Matchers.equalTo;
public class Java8SortUnitTest {
@@ -1,22 +1,18 @@
package com.baeldung.java8;
import static org.junit.Assert.assertEquals;
import org.apache.commons.io.FileUtils;
import org.junit.Before;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.text.DecimalFormat;
import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.StreamSupport;
import org.apache.commons.io.FileUtils;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class JavaFolderSizeTest {
@@ -93,7 +89,7 @@ public class JavaFolderSizeTest {
final File folder = new File(path);
final long size = getFolderSize(folder);
final String[] units = new String[] { "B", "KB", "MB", "GB", "TB" };
final String[] units = new String[]{"B", "KB", "MB", "GB", "TB"};
final int unitIndex = (int) (Math.log10(size) / 3);
final double unitValue = 1 << (unitIndex * 10);
@@ -1,13 +1,13 @@
package com.baeldung.java8;
import org.junit.Assert;
import org.junit.Test;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Date;
import java.util.Scanner;
import org.junit.Assert;
import org.junit.Test;
public class JavaTryWithResourcesTest {
private static final String TEST_STRING_HELLO_WORLD = "Hello World";
@@ -1,14 +1,12 @@
package com.baeldung.java8.base64;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import java.io.UnsupportedEncodingException;
import org.apache.commons.codec.binary.Base64;
import org.junit.Test;
import java.io.UnsupportedEncodingException;
import static org.junit.Assert.*;
public class ApacheCommonsEncodeDecodeTest {
// tests
@@ -1,14 +1,12 @@
package com.baeldung.java8.base64;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;
import java.io.UnsupportedEncodingException;
import java.util.Base64;
import java.util.UUID;
import org.junit.Test;
import static org.junit.Assert.*;
public class Java8EncodeDecodeTest {