StringToPeriodConverterTests.java (spring-boot-2.7.3) | : | StringToPeriodConverterTests.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 40 | skipping to change at line 40 | |||
/** | /** | |||
* Tests for {@link StringToPeriodConverter}. | * Tests for {@link StringToPeriodConverter}. | |||
* | * | |||
* @author Eddú Meléndez | * @author Eddú Meléndez | |||
* @author Edson Chávez | * @author Edson Chávez | |||
*/ | */ | |||
class StringToPeriodConverterTests { | class StringToPeriodConverterTests { | |||
@ConversionServiceTest | @ConversionServiceTest | |||
void convertWhenIso8601ShouldReturnPeriod(ConversionService conversionSer vice) { | void convertWhenIso8601ShouldReturnPeriod(ConversionService conversionSer vice) { | |||
assertThat(convert(conversionService, "p2y")).isEqualTo(Period.pa rse("p2y")); | ||||
assertThat(convert(conversionService, "P2Y")).isEqualTo(Period.pa rse("P2Y")); | assertThat(convert(conversionService, "P2Y")).isEqualTo(Period.pa rse("P2Y")); | |||
assertThat(convert(conversionService, "P3M")).isEqualTo(Period.pa rse("P3M")); | assertThat(convert(conversionService, "P3M")).isEqualTo(Period.pa rse("P3M")); | |||
assertThat(convert(conversionService, "P4W")).isEqualTo(Period.pa rse("P4W")); | assertThat(convert(conversionService, "P4W")).isEqualTo(Period.pa rse("P4W")); | |||
assertThat(convert(conversionService, "P5D")).isEqualTo(Period.pa rse("P5D")); | assertThat(convert(conversionService, "P5D")).isEqualTo(Period.pa rse("P5D")); | |||
assertThat(convert(conversionService, "P1Y2M3D")).isEqualTo(Perio d.parse("P1Y2M3D")); | assertThat(convert(conversionService, "P1Y2M3D")).isEqualTo(Perio d.parse("P1Y2M3D")); | |||
assertThat(convert(conversionService, "P1Y2M3W4D")).isEqualTo(Per iod.parse("P1Y2M3W4D")); | assertThat(convert(conversionService, "P1Y2M3W4D")).isEqualTo(Per iod.parse("P1Y2M3W4D")); | |||
assertThat(convert(conversionService, "P-1Y2M")).isEqualTo(Period .parse("P-1Y2M")); | assertThat(convert(conversionService, "P-1Y2M")).isEqualTo(Period .parse("P-1Y2M")); | |||
assertThat(convert(conversionService, "-P1Y2M")).isEqualTo(Period .parse("-P1Y2M")); | assertThat(convert(conversionService, "-P1Y2M")).isEqualTo(Period .parse("-P1Y2M")); | |||
} | } | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added |