This commit is contained in:
Stéphane Nicoll
2024-01-17 17:43:47 +01:00
parent 699da7c383
commit f5b0d9509d
45 changed files with 373 additions and 411 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -199,7 +199,7 @@ class CandidateComponentsIndexerTests {
@Test
void embeddedCandidatesAreDetected()
throws IOException, ClassNotFoundException {
throws ClassNotFoundException {
// Validate nested type structure
String nestedType = "org.springframework.context.index.sample.SampleEmbedded.Another$AnotherPublicCandidate";
Class<?> type = ClassUtils.forName(nestedType, getClass().getClassLoader());
@@ -249,8 +249,7 @@ class CandidateComponentsIndexerTests {
File metadataFile = new File(outputLocation, MetadataStore.METADATA_PATH);
if (metadataFile.isFile()) {
try (FileInputStream fileInputStream = new FileInputStream(metadataFile)) {
CandidateComponentsMetadata metadata = PropertiesMarshaller.read(fileInputStream);
return metadata;
return PropertiesMarshaller.read(fileInputStream);
}
catch (IOException ex) {
throw new IllegalStateException("Failed to read metadata from disk", ex);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,10 +33,10 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Stephane Nicoll
* @author Vedran Pavic
*/
public class PropertiesMarshallerTests {
class PropertiesMarshallerTests {
@Test
public void readWrite() throws IOException {
void readWrite() throws IOException {
CandidateComponentsMetadata metadata = new CandidateComponentsMetadata();
metadata.add(createItem("com.foo", "first", "second"));
metadata.add(createItem("com.bar", "first"));
@@ -51,7 +51,7 @@ public class PropertiesMarshallerTests {
}
@Test
public void metadataIsWrittenDeterministically() throws IOException {
void metadataIsWrittenDeterministically() throws IOException {
CandidateComponentsMetadata metadata = new CandidateComponentsMetadata();
metadata.add(createItem("com.b", "type"));
metadata.add(createItem("com.c", "type"));
@@ -59,7 +59,7 @@ public class PropertiesMarshallerTests {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
PropertiesMarshaller.write(metadata, outputStream);
String contents = new String(outputStream.toByteArray(), StandardCharsets.ISO_8859_1);
String contents = outputStream.toString(StandardCharsets.ISO_8859_1);
assertThat(contents.split(System.lineSeparator())).containsExactly("com.a=type", "com.b=type", "com.c=type");
}