|
41 | 41 | */
|
42 | 42 | class DurationFormatterUtilsTests {
|
43 | 43 |
|
| 44 | + @ParameterizedTest |
| 45 | + @EnumSource(DurationFormat.Style.class) |
| 46 | + void parseEmptyStringFailsWithDedicatedException(DurationFormat.Style style) { |
| 47 | + assertThatIllegalArgumentException() |
| 48 | + .isThrownBy(() -> DurationFormatterUtils.parse("", style)) |
| 49 | + .withMessage("Value must not be empty"); |
| 50 | + } |
| 51 | + |
| 52 | + @ParameterizedTest |
| 53 | + @EnumSource(DurationFormat.Style.class) |
| 54 | + void parseNullStringFailsWithDedicatedException(DurationFormat.Style style) { |
| 55 | + assertThatIllegalArgumentException() |
| 56 | + .isThrownBy(() -> DurationFormatterUtils.parse(null, style)) |
| 57 | + .withMessage("Value must not be empty"); |
| 58 | + } |
| 59 | + |
44 | 60 | @Test
|
45 | 61 | void parseSimpleWithUnits() {
|
46 | 62 | Duration nanos = DurationFormatterUtils.parse("1ns", SIMPLE, Unit.SECONDS);
|
@@ -191,22 +207,6 @@ void parseCompositeBadUnit() {
|
191 | 207 | .havingCause().withMessage("Does not match composite duration pattern");
|
192 | 208 | }
|
193 | 209 |
|
194 |
| - @ParameterizedTest |
195 |
| - @EnumSource(DurationFormat.Style.class) |
196 |
| - void parseEmptyStringThrowsForAllStyles(DurationFormat.Style style) { |
197 |
| - assertThatIllegalArgumentException() |
198 |
| - .isThrownBy(() -> DurationFormatterUtils.parse("", style)) |
199 |
| - .withMessage("Value must not be empty"); |
200 |
| - } |
201 |
| - |
202 |
| - @ParameterizedTest |
203 |
| - @EnumSource(DurationFormat.Style.class) |
204 |
| - void parseNullStringThrowsForAllStyles(DurationFormat.Style style) { |
205 |
| - assertThatIllegalArgumentException() |
206 |
| - .isThrownBy(() -> DurationFormatterUtils.parse(null, style)) |
207 |
| - .withMessage("Value must not be empty"); |
208 |
| - } |
209 |
| - |
210 | 210 | @Test
|
211 | 211 | void printSimple() {
|
212 | 212 | assertThat(DurationFormatterUtils.print(Duration.ofNanos(12345), SIMPLE, Unit.NANOS))
|
@@ -259,14 +259,6 @@ void printCompositeNegative() {
|
259 | 259 | .isEqualTo("-1d2h34m57s28ms3us2ns");
|
260 | 260 | }
|
261 | 261 |
|
262 |
| - @ParameterizedTest |
263 |
| - @EnumSource(DurationFormat.Style.class) |
264 |
| - void printNullDurationThrowsForAllStyles(DurationFormat.Style style) { |
265 |
| - assertThatIllegalArgumentException() |
266 |
| - .isThrownBy(() -> DurationFormatterUtils.print(null, style)) |
267 |
| - .withMessage("Value must not be null"); |
268 |
| - } |
269 |
| - |
270 | 262 | @Test
|
271 | 263 | void detectAndParse() {
|
272 | 264 | assertThat(DurationFormatterUtils.detectAndParse("PT1.234S", Unit.NANOS))
|
|
0 commit comments