Skip to content

Commit d5bec12

Browse files
author
arunp
committed
Simplify lambda statements
1 parent e499449 commit d5bec12

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/test/java/org/example/LeapYearCalculatorSpec.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class A_year_is_supported {
5656
@ValueSource(ints = { 1, Integer.MAX_VALUE })
5757
void if_it_is_positive(int year) {
5858
thenNoException()
59-
.isThrownBy(() -> { isLeapYear(year); });
59+
.isThrownBy(() -> isLeapYear(year));
6060
}
6161

6262
}
@@ -69,15 +69,15 @@ class A_year_is_not_supported {
6969
void if_it_is_zero() {
7070
thenExceptionOfType
7171
(IllegalArgumentException.class)
72-
.isThrownBy(() -> { isLeapYear(0); });
72+
.isThrownBy(() -> isLeapYear(0));
7373
}
7474

7575
@ParameterizedTest
7676
@ValueSource(ints = { -1, -4, -100, -400, Integer.MIN_VALUE })
7777
void if_it_is_negative(int year) {
7878
thenExceptionOfType
7979
(IllegalArgumentException.class)
80-
.isThrownBy(() -> { isLeapYear(year); });
80+
.isThrownBy(() -> isLeapYear(year));
8181
}
8282

8383
}

src/test/java/org/example/QueueSpecTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ void preserves_positive_bounding_capacity() {
3434
void rejects_a_zero_bounding_capacity() {
3535
thenExceptionOfType
3636
(IllegalArgumentException.class)
37-
.isThrownBy(() -> { new Queue<>(0); });
37+
.isThrownBy(() -> new Queue<>(0));
3838

3939
}
4040

4141
@Test
4242
void rejects_a_negative_bounding_capacity() {
4343
thenExceptionOfType
4444
(IllegalArgumentException.class)
45-
.isThrownBy(() -> { new Queue<>(-1); });
45+
.isThrownBy(() -> new Queue<>(-1));
4646

4747
}
4848

src/test/java/org/example/StackTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ class An_empty_stack {
3030
void throws_when_queried_for_its_top_item() {
3131
thenExceptionOfType
3232
(IllegalStateException.class)
33-
.isThrownBy(() -> { (new Stack<>()).top(); });
33+
.isThrownBy(() -> (new Stack<>()).top());
3434
}
3535

3636
@Test
3737
void throws_when_popped() {
3838
thenExceptionOfType
3939
(IllegalStateException.class)
40-
.isThrownBy(() -> { (new Stack<>()).pop(); });
40+
.isThrownBy(() -> (new Stack<>()).pop());
4141
}
4242

4343
@Test

0 commit comments

Comments
 (0)