Skip to content

Commit

Permalink
changed variable scope
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldietrich committed Feb 27, 2016
1 parent 94ce617 commit 17b5be5
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions javaslang/src/test/java/javaslang/control/ValidationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -274,19 +274,21 @@ public void shouldMapFailure() {

@Test
public void shouldProcessFunctionInForEach() {
final java.util.List<String> accumulator = new ArrayList<>();

Validation<String, String> v1 = Validation.valid("valid");
Validation<String, String> v2 = Validation.invalid("error");

accumulator.clear();
v1.forEach(accumulator::add);
assertThat(accumulator.size()).isEqualTo(1);
assertThat(accumulator.get(0)).isEqualTo("valid");
{ // Valid.forEach
java.util.List<String> accumulator = new ArrayList<>();
Validation<String, String> v1 = Validation.valid("valid");
v1.forEach(accumulator::add);
assertThat(accumulator.size()).isEqualTo(1);
assertThat(accumulator.get(0)).isEqualTo("valid");
}

accumulator.clear();
v2.forEach(accumulator::add);
assertThat(accumulator.size()).isEqualTo(0);
{ // Invalid.forEach
java.util.List<String> accumulator = new ArrayList<>();
Validation<String, String> v2 = Validation.invalid("error");
v2.forEach(accumulator::add);
assertThat(accumulator.size()).isEqualTo(0);
}
}

// -- combine and apply
Expand Down

0 comments on commit 17b5be5

Please sign in to comment.