Skip to content

Commit

Permalink
chore(deprecated assertions): replace deprecated assertions, issue ec…
Browse files Browse the repository at this point in the history
…lipse-jkube#3134

Signed-off-by: arman-yekkehkhani <arman.yekkehkhani@gmail.com>
  • Loading branch information
arman-yekkehkhani committed Jun 6, 2024
1 parent 9842b0c commit d57f390
Showing 1 changed file with 23 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ void getProcessedLayers_withFlat_shouldReturnOriginalLayers() {
// Then
assertThat(result).hasSize(1).first()
.hasFieldOrPropertyWithValue("id", null)
.extracting(Assembly::getFiles).asList().hasSize(1).first()
.extracting(Assembly::getFiles)
.asInstanceOf(InstanceOfAssertFactories.list(AssemblyFile.class))
.singleElement()
.hasFieldOrPropertyWithValue("destName", "test");

}
Expand All @@ -143,7 +145,9 @@ void getProcessedLayers_withSingleNoIdLayer_shouldAddIdToLayer() {
// Then
assertThat(result).hasSize(1).first()
.hasFieldOrPropertyWithValue("id", "jkube-generated-layer-original")
.extracting(Assembly::getFiles).asList().hasSize(1).first()
.extracting(Assembly::getFiles)
.asInstanceOf(InstanceOfAssertFactories.list(AssemblyFile.class))
.singleElement()
.hasFieldOrPropertyWithValue("destName", "test");
}

Expand Down Expand Up @@ -184,12 +188,16 @@ void getProcessedLayers_withSingleNoIdLayerAndArtifact_shouldReturnOriginalAndAr
assertThat(result).hasSize(2)
.anySatisfy(layer -> assertThat(layer)
.hasFieldOrPropertyWithValue("id", "jkube-generated-layer-original")
.extracting(Assembly::getFiles).asList().hasSize(1).first()
.extracting(Assembly::getFiles)
.asInstanceOf(InstanceOfAssertFactories.list(AssemblyFile.class))
.singleElement()
.hasFieldOrPropertyWithValue("destName", "test")
)
.element(1)
.hasFieldOrPropertyWithValue("id", "jkube-generated-layer-final-artifact")
.extracting(Assembly::getFiles).asList().hasSize(1).first()
.extracting(Assembly::getFiles)
.asInstanceOf(InstanceOfAssertFactories.list(AssemblyFile.class))
.singleElement()
.hasFieldOrPropertyWithValue("destName", "final-artifact.jar");
}

Expand All @@ -215,7 +223,9 @@ void getFlattenedClone_withNoInlineAndNoLayers_shouldReturnEmpty() {
// Then
assertThat(result.getFlattenedClone(configuration))
.hasFieldOrPropertyWithValue("flattened", true)
.extracting(AssemblyConfiguration::getLayers).asList().hasSize(1).first()
.extracting(AssemblyConfiguration::getLayers)
.asInstanceOf(InstanceOfAssertFactories.list(Assembly.class))
.singleElement()
.hasFieldOrPropertyWithValue("id", null)
.hasFieldOrPropertyWithValue("fileSets", Collections.emptyList())
.hasFieldOrPropertyWithValue("files", Collections.emptyList());
Expand All @@ -241,14 +251,16 @@ void getFlattenedClone_withInlineAndLayers_shouldReturnInlinesAndInlineLast() {
// Then
assertThat(result.getFlattenedClone(configuration))
.hasFieldOrPropertyWithValue("flattened", true)
.extracting(AssemblyConfiguration::getLayers).asList().hasSize(1)
.first().asInstanceOf(InstanceOfAssertFactories.type(Assembly.class))
.extracting(AssemblyConfiguration::getLayers)
.asInstanceOf(InstanceOfAssertFactories.list(Assembly.class))
.singleElement()
.hasFieldOrPropertyWithValue("id", null)
.hasFieldOrPropertyWithValue("fileSets", Arrays.asList(
AssemblyFileSet.builder().directory(new File("target")).build(),
AssemblyFileSet.builder().directory(new File("static")).build()
))
.extracting(Assembly::getFiles).asList()
.extracting(Assembly::getFiles)
.asInstanceOf(InstanceOfAssertFactories.list(AssemblyFile.class))
.extracting("destName")
.containsExactly("file.1", "file.2", "file.3", "file.old");
}
Expand Down Expand Up @@ -283,7 +295,9 @@ void rawDeserialization() throws IOException {
.hasFieldOrPropertyWithValue("user", "root")
.hasFieldOrPropertyWithValue("tarLongFileMode", "posix")
.hasFieldOrPropertyWithValue("flattened", false)
.extracting(AssemblyConfiguration::getLayers).asList().extracting("id")
.extracting(AssemblyConfiguration::getLayers)
.asInstanceOf(InstanceOfAssertFactories.list(Assembly.class))
.extracting("id")
.containsExactly("multi-layer-support", "not-the-last-layer", "deprecated-single");
}
}

0 comments on commit d57f390

Please sign in to comment.