diff options
Diffstat (limited to 'guava-tests/test/com/google/common/collect/GeneralRangeTest.java')
-rw-r--r-- | guava-tests/test/com/google/common/collect/GeneralRangeTest.java | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/guava-tests/test/com/google/common/collect/GeneralRangeTest.java b/guava-tests/test/com/google/common/collect/GeneralRangeTest.java index 46f2e75..a90e5d1 100644 --- a/guava-tests/test/com/google/common/collect/GeneralRangeTest.java +++ b/guava-tests/test/com/google/common/collect/GeneralRangeTest.java @@ -1,11 +1,11 @@ /* * Copyright (C) 2011 The Guava Authors - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing permissions and @@ -17,19 +17,20 @@ package com.google.common.collect; import static com.google.common.collect.BoundType.CLOSED; import static com.google.common.collect.BoundType.OPEN; +import java.util.Arrays; +import java.util.Comparator; +import java.util.List; + +import junit.framework.TestCase; + import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.GwtIncompatible; import com.google.common.base.Objects; import com.google.common.testing.NullPointerTester; -import junit.framework.TestCase; - -import java.util.Arrays; -import java.util.List; - /** * Tests for {@code GeneralRange}. - * + * * @author Louis Wasserman */ @GwtCompatible(emulated = true) @@ -42,7 +43,7 @@ public class GeneralRangeTest extends TestCase { for (BoundType lboundType : BoundType.values()) { for (BoundType uboundType : BoundType.values()) { try { - GeneralRange.range(ORDERING, 4, lboundType, 2, uboundType); + GeneralRange<Integer> range = GeneralRange.range(ORDERING, 4, lboundType, 2, uboundType); fail("Expected IAE"); } catch (IllegalArgumentException expected) {} } @@ -121,7 +122,7 @@ public class GeneralRangeTest extends TestCase { public void testDoublyBoundedAgainstRange() { for (BoundType lboundType : BoundType.values()) { for (BoundType uboundType : BoundType.values()) { - Range<Integer> range = Range.range(2, lboundType, 4, uboundType); + Range<Integer> range = Ranges.range(2, lboundType, 4, uboundType); GeneralRange<Integer> gRange = GeneralRange.range(ORDERING, 2, lboundType, 4, uboundType); for (Integer i : IN_ORDER_VALUES) { assertEquals(i != null && range.contains(i), gRange.contains(i)); @@ -170,16 +171,16 @@ public class GeneralRangeTest extends TestCase { } public void testFromRangeAll() { - assertEquals(GeneralRange.all(Ordering.natural()), GeneralRange.from(Range.all())); + assertEquals(GeneralRange.all(Ordering.natural()), GeneralRange.from(Ranges.all())); } public void testFromRangeOneEnd() { for (BoundType endpointType : BoundType.values()) { assertEquals(GeneralRange.upTo(Ordering.natural(), 3, endpointType), - GeneralRange.from(Range.upTo(3, endpointType))); + GeneralRange.from(Ranges.upTo(3, endpointType))); assertEquals(GeneralRange.downTo(Ordering.natural(), 3, endpointType), - GeneralRange.from(Range.downTo(3, endpointType))); + GeneralRange.from(Ranges.downTo(3, endpointType))); } } @@ -187,7 +188,7 @@ public class GeneralRangeTest extends TestCase { for (BoundType lowerType : BoundType.values()) { for (BoundType upperType : BoundType.values()) { assertEquals(GeneralRange.range(Ordering.natural(), 3, lowerType, 4, upperType), - GeneralRange.from(Range.range(3, lowerType, 4, upperType))); + GeneralRange.from(Ranges.range(3, lowerType, 4, upperType))); } } } @@ -203,7 +204,10 @@ public class GeneralRangeTest extends TestCase { } @GwtIncompatible("NullPointerTester") - public void testNullPointers() { - new NullPointerTester().testAllPublicStaticMethods(GeneralRange.class); + public void testNullPointers() throws Exception { + NullPointerTester tester = new NullPointerTester(); + tester.setDefault(Comparator.class, Ordering.arbitrary()); + tester.setDefault(BoundType.class, BoundType.CLOSED); + tester.testAllPublicStaticMethods(GeneralRange.class); } } |