-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
288c799
commit e0f9e19
Showing
2 changed files
with
70 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
sdk/java/pulumi/src/test/java/com/pulumi/resources/StackOptionsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package com.pulumi.resources; | ||
|
||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.Arguments; | ||
import org.junit.jupiter.params.provider.MethodSource; | ||
|
||
import javax.annotation.Nullable; | ||
import java.util.List; | ||
import java.util.Optional; | ||
import java.util.stream.Stream; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.junit.jupiter.params.provider.Arguments.arguments; | ||
|
||
class StackOptionsTest { | ||
|
||
public static Stream<Arguments> testMerge() { | ||
final ResourceTransformation transformation1 = args -> Optional.empty(); | ||
final ResourceTransformation transformation2 = args -> Optional.empty(); | ||
return Stream.of( | ||
arguments( | ||
null, | ||
null, | ||
new StackOptions(List.of()) | ||
), | ||
arguments( | ||
null, | ||
new StackOptions(List.of()), | ||
new StackOptions(List.of()) | ||
), | ||
arguments( | ||
new StackOptions(List.of()), | ||
null, | ||
new StackOptions(List.of()) | ||
), | ||
arguments( | ||
new StackOptions(List.of()), | ||
new StackOptions(List.of()), | ||
new StackOptions(List.of()) | ||
), | ||
arguments( | ||
new StackOptions(List.of(transformation1)), | ||
new StackOptions(List.of()), | ||
new StackOptions(List.of(transformation1)) | ||
), | ||
arguments( | ||
new StackOptions(List.of()), | ||
new StackOptions(List.of(transformation1)), | ||
new StackOptions(List.of(transformation1)) | ||
), | ||
arguments( | ||
new StackOptions(List.of(transformation1)), | ||
new StackOptions(List.of(transformation2)), | ||
new StackOptions(List.of(transformation1, transformation2)) | ||
) | ||
); | ||
} | ||
|
||
@ParameterizedTest | ||
@MethodSource | ||
void testMerge(@Nullable StackOptions first, @Nullable StackOptions second, StackOptions expected) { | ||
var result = StackOptions.merge(first, second); | ||
|
||
assertThat(result.resourceTransformations()).containsExactlyElementsOf(expected.resourceTransformations()); | ||
} | ||
} |