StringToDurationConverterTests.java (spring-boot-2.7.3) | : | StringToDurationConverterTests.java (spring-boot-2.7.4) | ||
---|---|---|---|---|
/* | /* | |||
* Copyright 2012-2020 the original author or authors. | * Copyright 2012-2022 the original author or authors. | |||
* | * | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | |||
* You may obtain a copy of the License at | * You may obtain a copy of the License at | |||
* | * | |||
* https://www.apache.org/licenses/LICENSE-2.0 | * https://www.apache.org/licenses/LICENSE-2.0 | |||
* | * | |||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | |||
* distributed under the License is distributed on an "AS IS" BASIS, | * distributed under the License is distributed on an "AS IS" BASIS, | |||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
skipping to change at line 41 | skipping to change at line 41 | |||
/** | /** | |||
* Tests for {@link StringToDurationConverter}. | * Tests for {@link StringToDurationConverter}. | |||
* | * | |||
* @author Phillip Webb | * @author Phillip Webb | |||
*/ | */ | |||
class StringToDurationConverterTests { | class StringToDurationConverterTests { | |||
@ConversionServiceTest | @ConversionServiceTest | |||
void convertWhenIso8601ShouldReturnDuration(ConversionService conversionS ervice) { | void convertWhenIso8601ShouldReturnDuration(ConversionService conversionS ervice) { | |||
assertThat(convert(conversionService, "pt20.345s")).isEqualTo(Dur ation.parse("pt20.345s")); | ||||
assertThat(convert(conversionService, "PT20.345S")).isEqualTo(Dur ation.parse("PT20.345S")); | assertThat(convert(conversionService, "PT20.345S")).isEqualTo(Dur ation.parse("PT20.345S")); | |||
assertThat(convert(conversionService, "PT15M")).isEqualTo(Duratio n.parse("PT15M")); | assertThat(convert(conversionService, "PT15M")).isEqualTo(Duratio n.parse("PT15M")); | |||
assertThat(convert(conversionService, "+PT15M")).isEqualTo(Durati on.parse("PT15M")); | assertThat(convert(conversionService, "+PT15M")).isEqualTo(Durati on.parse("PT15M")); | |||
assertThat(convert(conversionService, "PT10H")).isEqualTo(Duratio n.parse("PT10H")); | assertThat(convert(conversionService, "PT10H")).isEqualTo(Duratio n.parse("PT10H")); | |||
assertThat(convert(conversionService, "P2D")).isEqualTo(Duration. parse("P2D")); | assertThat(convert(conversionService, "P2D")).isEqualTo(Duration. parse("P2D")); | |||
assertThat(convert(conversionService, "P2DT3H4M")).isEqualTo(Dura tion.parse("P2DT3H4M")); | assertThat(convert(conversionService, "P2DT3H4M")).isEqualTo(Dura tion.parse("P2DT3H4M")); | |||
assertThat(convert(conversionService, "-PT6H3M")).isEqualTo(Durat ion.parse("-PT6H3M")); | assertThat(convert(conversionService, "-PT6H3M")).isEqualTo(Durat ion.parse("-PT6H3M")); | |||
assertThat(convert(conversionService, "-PT-6H+3M")).isEqualTo(Dur ation.parse("-PT-6H+3M")); | assertThat(convert(conversionService, "-PT-6H+3M")).isEqualTo(Dur ation.parse("-PT-6H+3M")); | |||
} | } | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added |