Formating.

This commit is contained in:
ggregory 2016-04-19 17:56:16 -07:00
parent c158713b66
commit e830027629
1 changed files with 46 additions and 47 deletions

View File

@ -49,27 +49,26 @@ public class RangeTest {
@SuppressWarnings("cast") // intRange
@Before
public void setUp() {
byteRange = Range.between((byte) 0, (byte) 5);
byteRange2 = Range.between((byte) 0, (byte) 5);
byteRange3 = Range.between((byte) 0, (byte) 10);
byteRange = Range.between((byte) 0, (byte) 5);
byteRange2 = Range.between((byte) 0, (byte) 5);
byteRange3 = Range.between((byte) 0, (byte) 10);
intRange = Range.between((int) 10, (int) 20);
longRange = Range.between((long) 10, (long) 20);
floatRange = Range.between((float) 10, (float) 20);
intRange = Range.between((int) 10, (int) 20);
longRange = Range.between((long) 10, (long) 20);
floatRange = Range.between((float) 10, (float) 20);
doubleRange = Range.between((double) 10, (double) 20);
}
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testComparableConstructors() {
final Comparable c =
new Comparable() {
@Override
public int compareTo(final Object other) {
return 1;
}
};
final Comparable c = new Comparable() {
@Override
public int compareTo(final Object other) {
return 1;
}
};
final Range r1 = Range.is(c);
final Range r2 = Range.between(c, c);
assertEquals(true, r1.isNaturalOrdering());
@ -77,21 +76,21 @@ public class RangeTest {
}
@Test
public void testIsWithCompare(){
final Comparator<Integer> c = new Comparator<Integer>(){
public void testIsWithCompare() {
final Comparator<Integer> c = new Comparator<Integer>() {
@Override
public int compare(final Integer o1, final Integer o2) {
return 0; // all integers are equal
}
};
Range<Integer> ri = Range.is(10);
assertFalse("should not contain null",ri.contains(null));
assertTrue("should contain 10",ri.contains(10));
assertFalse("should not contain 11",ri.contains(11));
ri = Range.is(10,c);
assertFalse("should not contain null",ri.contains(null));
assertTrue("should contain 10",ri.contains(10));
assertTrue("should contain 11",ri.contains(11));
assertFalse("should not contain null", ri.contains(null));
assertTrue("should contain 10", ri.contains(10));
assertFalse("should not contain 11", ri.contains(11));
ri = Range.is(10, c);
assertFalse("should not contain null", ri.contains(null));
assertTrue("should contain 10", ri.contains(10));
assertTrue("should contain 11", ri.contains(11));
}
@Test
@ -134,7 +133,7 @@ public class RangeTest {
assertFalse("should not contain ''", rbstr.contains(""));
}
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
@Test
public void testRangeOfChars() {
final Range<Character> chars = Range.between('a', 'z');
@ -142,7 +141,7 @@ public class RangeTest {
assertFalse(chars.contains('B'));
}
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
@Test
public void testEqualsObject() {
assertEquals(byteRange, byteRange);
@ -180,7 +179,7 @@ public class RangeTest {
assertEquals("From 10 to 20", str);
}
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
@Test
public void testGetMinimum() {
assertEquals(10, (int) intRange.getMinimum());
@ -257,7 +256,7 @@ public class RangeTest {
try {
intRange.elementCompareTo(null);
fail("NullPointerException should have been thrown");
} catch(final NullPointerException npe) {
} catch (final NullPointerException npe) {
// expected
}
@ -268,7 +267,7 @@ public class RangeTest {
assertEquals(1, intRange.elementCompareTo(25));
}
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
@Test
public void testContainsRange() {
@ -386,7 +385,7 @@ public class RangeTest {
intRange.intersectionWith(Range.between(0, 9));
}
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
@Test
public void testSerializing() {
SerializationUtils.clone(intRange);