Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace AssertJ's deprecated asList() DSL method with asInstanceOf(InstanceOfAssertFactories.list(type.class)) #3049

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -307,21 +307,21 @@ void withFastJarInTarget_shouldReturnFastJarAssemblyInImage() throws IOException
.hasFieldOrPropertyWithValue("targetDir", "/deployments")
.hasFieldOrPropertyWithValue("excludeFinalOutputArtifact", true)
.extracting(AssemblyConfiguration::getLayers)
.asList().hasSize(2)
.asInstanceOf(InstanceOfAssertFactories.list(Assembly.class)).hasSize(2)
.satisfies(layers -> assertThat(layers).first().asInstanceOf(InstanceOfAssertFactories.type(Assembly.class))
.hasFieldOrPropertyWithValue("id", "lib")
.extracting(Assembly::getFileSets)
.asList().singleElement()
.asInstanceOf(InstanceOfAssertFactories.list(Assembly.class)).singleElement()
.hasFieldOrPropertyWithValue("outputDirectory", new File("."))
.extracting("includes").asList()
.extracting("includes").asInstanceOf(InstanceOfAssertFactories.list(String.class))
.containsExactly("lib"))
.satisfies(layers -> assertThat(layers).element(1).asInstanceOf(InstanceOfAssertFactories.type(Assembly.class))
.hasFieldOrPropertyWithValue("id", "fast-jar")
.extracting(Assembly::getFileSets)
.asList().singleElement()
.asInstanceOf(InstanceOfAssertFactories.list(Assembly.class)).singleElement()
.hasFieldOrPropertyWithValue("outputDirectory", new File("."))
.hasFieldOrPropertyWithValue("excludes", Arrays.asList("lib/**/*", "lib/*"))
.extracting("includes").asList()
.extracting("includes").asInstanceOf(InstanceOfAssertFactories.list(String.class))
.containsExactly("quarkus-run.jar", "*", "**/*"));
}

Expand All @@ -345,9 +345,9 @@ void manualNativeSettings_shouldReturnNativeAssemblyInImage() throws IOException
.extracting(BuildConfiguration::getAssembly)
.hasFieldOrPropertyWithValue("targetDir", "/")
.extracting(AssemblyConfiguration::getLayers)
.asList().singleElement().asInstanceOf(InstanceOfAssertFactories.type(Assembly.class))
.asInstanceOf(InstanceOfAssertFactories.list(Assembly.class)).singleElement().asInstanceOf(InstanceOfAssertFactories.type(Assembly.class))
.extracting(Assembly::getFileSets)
.asList()
.asInstanceOf(InstanceOfAssertFactories.list(Assembly.class))
.hasSize(1)
.flatExtracting("includes")
.containsExactly("sample-runner");
Expand All @@ -368,9 +368,9 @@ void withNativeBinaryInTarget_shouldReturnNativeAssemblyInImage() throws IOExcep
.extracting(BuildConfiguration::getAssembly)
.hasFieldOrPropertyWithValue("targetDir", "/")
.extracting(AssemblyConfiguration::getLayers)
.asList().singleElement().asInstanceOf(InstanceOfAssertFactories.type(Assembly.class))
.asInstanceOf(InstanceOfAssertFactories.list(Assembly.class)).singleElement().asInstanceOf(InstanceOfAssertFactories.type(Assembly.class))
.extracting(Assembly::getFileSets)
.asList()
.asInstanceOf(InstanceOfAssertFactories.list(Assembly.class))
.hasSize(1)
.flatExtracting("includes")
.containsExactly("sample-runner");
Expand All @@ -393,18 +393,18 @@ void withLegacyJarInTarget_shouldReturnDefaultAssemblyInImage() throws IOExcepti
.hasFieldOrPropertyWithValue("targetDir", "/deployments")
.hasFieldOrPropertyWithValue("excludeFinalOutputArtifact", true)
.extracting(AssemblyConfiguration::getLayers)
.asList().hasSize(2)
.asInstanceOf(InstanceOfAssertFactories.list(Assembly.class)).hasSize(2)
.satisfies(layers -> assertThat(layers).first().asInstanceOf(InstanceOfAssertFactories.type(Assembly.class))
.hasFieldOrPropertyWithValue("id", "lib")
.extracting(Assembly::getFileSets)
.asList()
.asInstanceOf(InstanceOfAssertFactories.list(Assembly.class))
.hasSize(1)
.flatExtracting("includes")
.containsExactly("lib"))
.satisfies(layers -> assertThat(layers).element(1).asInstanceOf(InstanceOfAssertFactories.type(Assembly.class))
.hasFieldOrPropertyWithValue("id", "artifact")
.extracting(Assembly::getFileSets)
.asList()
.asInstanceOf(InstanceOfAssertFactories.list(Assembly.class))
.hasSize(1)
.flatExtracting("includes")
.containsExactly("sample-legacy-runner.jar"));
Expand Down Expand Up @@ -439,9 +439,9 @@ void withUberJarInTarget_shouldReturnAssemblyWithSingleJar() throws IOException
.extracting(BuildConfiguration::getAssembly)
.hasFieldOrPropertyWithValue("targetDir", "/deployments")
.extracting(AssemblyConfiguration::getLayers)
.asList().singleElement().asInstanceOf(InstanceOfAssertFactories.type(Assembly.class))
.asInstanceOf(InstanceOfAssertFactories.list(Assembly.class)).singleElement().asInstanceOf(InstanceOfAssertFactories.type(Assembly.class))
.extracting(Assembly::getFileSets)
.asList()
.asInstanceOf(InstanceOfAssertFactories.list(Assembly.class))
.hasSize(1)
.flatExtracting("includes")
.containsExactly("sample-runner.jar");
Expand All @@ -465,21 +465,21 @@ void withManualConfigAndFastJarAndLegacyInTarget_shouldReturnAssemblyForQuarkusA
.hasFieldOrPropertyWithValue("targetDir", "/deployments")
.hasFieldOrPropertyWithValue("excludeFinalOutputArtifact", true)
.extracting(AssemblyConfiguration::getLayers)
.asList().hasSize(2)
.asInstanceOf(InstanceOfAssertFactories.list(Assembly.class)).hasSize(2)
.satisfies(layers -> assertThat(layers).first().asInstanceOf(InstanceOfAssertFactories.type(Assembly.class))
.hasFieldOrPropertyWithValue("id", "lib")
.extracting(Assembly::getFileSets)
.asList().singleElement()
.asInstanceOf(InstanceOfAssertFactories.list(Assembly.class)).singleElement()
.hasFieldOrPropertyWithValue("outputDirectory", new File("."))
.extracting("includes").asList()
.extracting("includes").asInstanceOf(InstanceOfAssertFactories.list(String.class))
.containsExactly("lib"))
.satisfies(layers -> assertThat(layers).element(1).asInstanceOf(InstanceOfAssertFactories.type(Assembly.class))
.hasFieldOrPropertyWithValue("id", "fast-jar")
.extracting(Assembly::getFileSets)
.asList().singleElement()
.asInstanceOf(InstanceOfAssertFactories.list(Assembly.class)).singleElement()
.hasFieldOrPropertyWithValue("outputDirectory", new File("."))
.hasFieldOrPropertyWithValue("excludes", Arrays.asList("lib/**/*", "lib/*"))
.extracting("includes").asList()
.extracting("includes").asInstanceOf(InstanceOfAssertFactories.list(String.class))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think maybe you can directly use InstanceOfAssertFactories.STRING here. Could you please check if it's working with InstanceOfAssertFactories.STRING?

.containsExactly("quarkus-run.jar", "*", "**/*"));
}

Expand Down