aboutsummaryrefslogtreecommitdiff
path: root/guava-tests/test/com/google/common/primitives/ByteArrayAsListTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'guava-tests/test/com/google/common/primitives/ByteArrayAsListTest.java')
-rw-r--r--guava-tests/test/com/google/common/primitives/ByteArrayAsListTest.java47
1 files changed, 25 insertions, 22 deletions
diff --git a/guava-tests/test/com/google/common/primitives/ByteArrayAsListTest.java b/guava-tests/test/com/google/common/primitives/ByteArrayAsListTest.java
index c3d0be1ab..585c4c8ef 100644
--- a/guava-tests/test/com/google/common/primitives/ByteArrayAsListTest.java
+++ b/guava-tests/test/com/google/common/primitives/ByteArrayAsListTest.java
@@ -27,11 +27,13 @@ import com.google.common.collect.testing.TestListGenerator;
import com.google.common.collect.testing.features.CollectionFeature;
import com.google.common.collect.testing.features.CollectionSize;
import com.google.common.collect.testing.features.ListFeature;
-import java.util.List;
+
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
+import java.util.List;
+
/**
* Test suite covering {@link Bytes#asList(byte[])}.
*
@@ -43,33 +45,37 @@ public class ByteArrayAsListTest extends TestCase {
private static List<Byte> asList(Byte[] values) {
byte[] temp = new byte[values.length];
for (int i = 0; i < values.length; i++) {
- temp[i] = checkNotNull(values[i]); // checkNotNull for GWT (do not optimize).
+ temp[i] = checkNotNull(values[i]); // checkNotNull for GWT (do not optimize).
}
return Bytes.asList(temp);
}
- @GwtIncompatible // suite
+ @GwtIncompatible("suite")
public static Test suite() {
List<ListTestSuiteBuilder<Byte>> builders =
ImmutableList.of(
- ListTestSuiteBuilder.using(new BytesAsListGenerator()).named("Bytes.asList"),
+ ListTestSuiteBuilder.using(new BytesAsListGenerator())
+ .named("Bytes.asList"),
+
ListTestSuiteBuilder.using(new BytesAsListHeadSubListGenerator())
.named("Bytes.asList, head subList"),
+
ListTestSuiteBuilder.using(new BytesAsListTailSubListGenerator())
.named("Bytes.asList, tail subList"),
+
ListTestSuiteBuilder.using(new BytesAsListMiddleSubListGenerator())
- .named("Bytes.asList, middle subList"));
+ .named("Bytes.asList, middle subList")
+ );
TestSuite suite = new TestSuite();
for (ListTestSuiteBuilder<Byte> builder : builders) {
suite.addTest(
builder
- .withFeatures(
- CollectionSize.ONE,
- CollectionSize.SEVERAL,
- CollectionFeature.RESTRICTS_ELEMENTS,
- ListFeature.SUPPORTS_SET)
- .createTestSuite());
+ .withFeatures(CollectionSize.ONE,
+ CollectionSize.SEVERAL,
+ CollectionFeature.RESTRICTS_ELEMENTS,
+ ListFeature.SUPPORTS_SET)
+ .createTestSuite());
}
return suite;
}
@@ -78,15 +84,13 @@ public class ByteArrayAsListTest extends TestCase {
// public named classes with a public default constructor.
public static final class BytesAsListGenerator extends TestByteListGenerator {
- @Override
- protected List<Byte> create(Byte[] elements) {
+ @Override protected List<Byte> create(Byte[] elements) {
return asList(elements);
}
}
public static final class BytesAsListHeadSubListGenerator extends TestByteListGenerator {
- @Override
- protected List<Byte> create(Byte[] elements) {
+ @Override protected List<Byte> create(Byte[] elements) {
Byte[] suffix = {Byte.MIN_VALUE, Byte.MAX_VALUE};
Byte[] all = concat(elements, suffix);
return asList(all).subList(0, elements.length);
@@ -94,8 +98,7 @@ public class ByteArrayAsListTest extends TestCase {
}
public static final class BytesAsListTailSubListGenerator extends TestByteListGenerator {
- @Override
- protected List<Byte> create(Byte[] elements) {
+ @Override protected List<Byte> create(Byte[] elements) {
Byte[] prefix = {(byte) 86, (byte) 99};
Byte[] all = concat(prefix, elements);
return asList(all).subList(2, elements.length + 2);
@@ -103,8 +106,7 @@ public class ByteArrayAsListTest extends TestCase {
}
public static final class BytesAsListMiddleSubListGenerator extends TestByteListGenerator {
- @Override
- protected List<Byte> create(Byte[] elements) {
+ @Override protected List<Byte> create(Byte[] elements) {
Byte[] prefix = {Byte.MIN_VALUE, Byte.MAX_VALUE};
Byte[] suffix = {(byte) 86, (byte) 99};
Byte[] all = concat(concat(prefix, elements), suffix);
@@ -119,7 +121,8 @@ public class ByteArrayAsListTest extends TestCase {
return result;
}
- public abstract static class TestByteListGenerator implements TestListGenerator<Byte> {
+ public static abstract class TestByteListGenerator
+ implements TestListGenerator<Byte> {
@Override
public SampleElements<Byte> samples() {
return new SampleBytes();
@@ -136,8 +139,8 @@ public class ByteArrayAsListTest extends TestCase {
}
/**
- * Creates a new collection containing the given elements; implement this method instead of
- * {@link #create(Object...)}.
+ * Creates a new collection containing the given elements; implement this
+ * method instead of {@link #create(Object...)}.
*/
protected abstract List<Byte> create(Byte[] elements);