Upgrade project to use using openrewrite.

This commit is contained in:
SkylerWu328 2025-11-18 16:35:54 +08:00
parent 30aab0ae76
commit cae30c39ef
3 changed files with 9 additions and 8 deletions

View file

@ -18,7 +18,7 @@
<properties>
<!-- Generic properties -->
<java.version>17</java.version>
<java.version>21</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- Important for reproducible builds. Update using e.g. ./mvnw versions:set -DnewVersion=... -->
@ -30,7 +30,7 @@
<webjars-font-awesome.version>4.7.0</webjars-font-awesome.version>
<checkstyle.version>10.25.0</checkstyle.version>
<jacoco.version>0.8.13</jacoco.version>
<jacoco.version>0.8.14</jacoco.version>
<libsass.version>0.3.4</libsass.version>
<lifecycle-mapping>1.0.0</lifecycle-mapping>
<maven-checkstyle.version>3.6.0</maven-checkstyle.version>

View file

@ -100,8 +100,8 @@ class ClinicServiceTests {
Owner owner = optionalOwner.get();
assertThat(owner.getLastName()).startsWith("Franklin");
assertThat(owner.getPets()).hasSize(1);
assertThat(owner.getPets().get(0).getType()).isNotNull();
assertThat(owner.getPets().get(0).getType().getName()).isEqualTo("cat");
assertThat(owner.getPets().getFirst().getType()).isNotNull();
assertThat(owner.getPets().getFirst().getType().getName()).isEqualTo("cat");
}
@Test
@ -208,7 +208,7 @@ class ClinicServiceTests {
Vet vet = EntityUtils.getById(vets, Vet.class, 3);
assertThat(vet.getLastName()).isEqualTo("Douglas");
assertThat(vet.getNrOfSpecialties()).isEqualTo(2);
assertThat(vet.getSpecialties().get(0).getName()).isEqualTo("dentistry");
assertThat(vet.getSpecialties().getFirst().getName()).isEqualTo("dentistry");
assertThat(vet.getSpecialties().get(1).getName()).isEqualTo("surgery");
}

View file

@ -3,7 +3,8 @@ package org.springframework.samples.petclinic.system;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.nio.file.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -38,7 +39,7 @@ public class I18nPropertiesSyncTest {
@Test
public void checkNonInternationalizedStrings() throws IOException {
Path root = Paths.get("src/main");
Path root = Path.of("src/main");
List<Path> files;
try (Stream<Path> stream = Files.walk(root)) {
@ -85,7 +86,7 @@ public class I18nPropertiesSyncTest {
@Test
public void checkI18nPropertyFilesAreInSync() throws IOException {
List<Path> propertyFiles;
try (Stream<Path> stream = Files.walk(Paths.get(I18N_DIR))) {
try (Stream<Path> stream = Files.walk(Path.of(I18N_DIR))) {
propertyFiles = stream.filter(p -> p.getFileName().toString().startsWith(BASE_NAME))
.filter(p -> p.getFileName().toString().endsWith(PROPERTIES))
.toList();