Skip to content

Commit

Permalink
#478 Removed NULL handling
Browse files Browse the repository at this point in the history
  • Loading branch information
svendiedrichsen committed Dec 1, 2017
1 parent 9761013 commit c97a94d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/main/java/org/cactoos/iterable/RangeOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ public RangeOf(final T min, final T max, final Func<T, T> incrementor) {
final List<T> values =
new ArrayList<>(0);
T value = min;
while (value != null
&& (max == null || value.compareTo(max) < 1)) {
while (value.compareTo(max) < 1) {
values.add(value);
value = func.apply(value);
}
Expand Down
10 changes: 5 additions & 5 deletions src/test/java/org/cactoos/iterable/RangeOfTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@
public class RangeOfTest {

@Test
public final void testIntegerRange() throws Exception {
public final void testIntegerRange() {
MatcherAssert.assertThat(
"Can't generate a range of integers",
new CollectionOf<>(
new RangeOf<>(1, 5, input -> input + 1)
new RangeOf<>(1, 5, input -> ++input)
),
Matchers.contains(1, 2, 3, 4, 5)
);
}

@Test
public final void testIntegerEmptyRange() throws Exception {
@Test(expected = NullPointerException.class)
public final void testIntegerEmptyRange() {
MatcherAssert.assertThat(
"Can't generate an empty range of integers",
new CollectionOf<>(
Expand All @@ -64,7 +64,7 @@ public final void testIntegerEmptyRange() throws Exception {
}

@Test
public final void testCharacterRange() throws Exception {
public final void testCharacterRange() {
MatcherAssert.assertThat(
"Can't generate a range of characters",
new CollectionOf<>(
Expand Down

0 comments on commit c97a94d

Please sign in to comment.