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