下面列出了org.junit.jupiter.api.DynamicNode#org.junit.jupiter.api.DynamicContainer 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@TestFactory
@DisplayName("Objects")
Stream<DynamicNode> objects() {
Map<String, Map<String, Object>> supportedTypes = new HashMap<>();
supportedTypes.put("CypherTypes", CYPHER_TYPES);
supportedTypes.put("AdditionalTypes", ADDITIONAL_TYPES);
supportedTypes.put("SpatialTypes", SPATIAL_TYPES);
return supportedTypes.entrySet().stream()
.map(types -> {
DynamicContainer reads = DynamicContainer.dynamicContainer("read", types.getValue().entrySet().stream()
.map(a -> dynamicTest(a.getKey(),
() -> Neo4jConversionsIT.assertRead(types.getKey(), a.getKey(), a.getValue()))));
DynamicContainer writes = DynamicContainer.dynamicContainer("write", types.getValue().entrySet().stream()
.map(a -> dynamicTest(a.getKey(),
() -> Neo4jConversionsIT.assertWrite(types.getKey(), a.getKey(), a.getValue()))));
return DynamicContainer.dynamicContainer(types.getKey(), Arrays.asList(reads, writes));
});
}
@TestFactory
List<DynamicContainer> registeredTests() {
return asList(
dynamicContainer(
"Dynamic Container #1",
asList(
dynamicTest(
"Dynamic Test #1",
() -> System.out.println("Hi, this is Dynamic Test #1!")),
dynamicTest(
"Dynamic Test #2",
() -> System.out.println("Hi, this is Dynamic Test #2!")))
),
dynamicContainer(
"Dynamic Container #2",
asList(
dynamicTest(
"Dynamic Test #A",
() -> System.out.println("Hi, this is Dynamic Test #A!")),
dynamicTest(
"Dynamic Test #B",
() -> System.out.println("Hi, this is Dynamic Test #B!")))
)
);
}
@WithAccessId(user = INSIDE_DYNAMIC_TEST_USER)
@TestFactory
DynamicContainer should_SetAccessIdForDynamicContainer_When_AnnotationExists() {
return dynamicContainer(
"dynamic container",
Stream.of(DYNAMIC_TEST_USER_DYNAMIC_TEST, DYNAMIC_TEST_USER_DYNAMIC_TEST));
}
@WithAccessId(user = INSIDE_DYNAMIC_TEST_USER)
@WithAccessId(user = INSIDE_DYNAMIC_TEST_USER)
@TestFactory
DynamicContainer should_SetMultipleAccessIdForDynamicContainer_When_AnnotationsExist() {
return dynamicContainer(
"dynamic container", Stream.of(NOT_NULL_DYNAMIC_TEST, NOT_NULL_DYNAMIC_TEST));
}
@WithAccessId(user = INSIDE_DYNAMIC_TEST_USER)
@TestFactory
DynamicContainer should_SetAccessIdForNestedDynamicContainer_When_AnnotationExists() {
DynamicContainer container =
dynamicContainer(
"nested container",
Stream.of(DYNAMIC_TEST_USER_DYNAMIC_TEST, DYNAMIC_TEST_USER_DYNAMIC_TEST));
return dynamicContainer(
"outside container", Stream.of(container, DYNAMIC_TEST_USER_DYNAMIC_TEST));
}
@WithAccessId(user = INSIDE_DYNAMIC_TEST_USER)
@WithAccessId(user = INSIDE_DYNAMIC_TEST_USER)
@TestFactory
DynamicContainer should_SetMultipleAccessIdForNestedDynamicContainer_When_AnnotationsExist() {
DynamicContainer container =
dynamicContainer(
"inside container", Stream.of(NOT_NULL_DYNAMIC_TEST, NOT_NULL_DYNAMIC_TEST));
return dynamicContainer("outside container", Stream.of(container, NOT_NULL_DYNAMIC_TEST));
}
@TestFactory
Stream<DynamicContainer>
should_NotSetAccessIdForDynamicContainerInStream_When_AnnotationIsMissing() {
Supplier<DynamicContainer> supplier =
() ->
dynamicContainer("dynamic container", Stream.of(NULL_DYNAMIC_TEST, NULL_DYNAMIC_TEST));
return Stream.generate(supplier).limit(2);
}
@WithAccessId(user = INSIDE_DYNAMIC_TEST_USER)
@TestFactory
Stream<DynamicContainer> should_SetAccessIdForDynamicContainerInStream_When_AnnotationExists() {
Supplier<DynamicContainer> supplier =
() ->
dynamicContainer(
"dynamic container",
Stream.of(DYNAMIC_TEST_USER_DYNAMIC_TEST, DYNAMIC_TEST_USER_DYNAMIC_TEST));
return Stream.generate(supplier).limit(2);
}
@WithAccessId(user = INSIDE_DYNAMIC_TEST_USER)
@WithAccessId(user = INSIDE_DYNAMIC_TEST_USER)
@TestFactory
Stream<DynamicContainer>
should_SetMultipleAccessIdForDynamicContainerInStream_When_AnnotationsExist() {
Supplier<DynamicContainer> supplier =
() ->
dynamicContainer(
"dynamic container", Stream.of(NOT_NULL_DYNAMIC_TEST, NOT_NULL_DYNAMIC_TEST));
return Stream.generate(supplier).limit(2);
}
@TestFactory
Stream<DynamicContainer>
should_NotSetAccessIdForNestedDynamicContainerInStream_When_AnnotationIsMissing() {
Supplier<DynamicContainer> supplier =
() -> dynamicContainer("inside container", Stream.of(NULL_DYNAMIC_TEST, NULL_DYNAMIC_TEST));
Supplier<DynamicContainer> outsideSupplier =
() -> dynamicContainer("outside container", Stream.of(supplier.get(), NULL_DYNAMIC_TEST));
return Stream.generate(outsideSupplier).limit(2);
}
@WithAccessId(user = INSIDE_DYNAMIC_TEST_USER)
@TestFactory
Stream<DynamicContainer>
should_SetAccessIdForNestedDynamicContainerInStream_When_AnnotationExists() {
Supplier<DynamicContainer> supplier =
() ->
dynamicContainer(
"inside container",
Stream.of(DYNAMIC_TEST_USER_DYNAMIC_TEST, DYNAMIC_TEST_USER_DYNAMIC_TEST));
Supplier<DynamicContainer> outsideSupplier =
() ->
dynamicContainer(
"outside container", Stream.of(supplier.get(), DYNAMIC_TEST_USER_DYNAMIC_TEST));
return Stream.generate(outsideSupplier).limit(2);
}
@WithAccessId(user = INSIDE_DYNAMIC_TEST_USER)
@WithAccessId(user = INSIDE_DYNAMIC_TEST_USER)
@TestFactory
Stream<DynamicContainer>
should_SetMultipleAccessIdForNestedDynamicContainerInStream_When_AnnotationsExist() {
Supplier<DynamicContainer> supplier =
() ->
dynamicContainer(
"inside container", Stream.of(NOT_NULL_DYNAMIC_TEST, NOT_NULL_DYNAMIC_TEST));
Supplier<DynamicContainer> outsideSupplier =
() ->
dynamicContainer("outside container", Stream.of(supplier.get(), NOT_NULL_DYNAMIC_TEST));
return Stream.generate(outsideSupplier).limit(2);
}
@TestFactory
Iterable<DynamicContainer>
should_NotSetAccessIdForDynamicContainerInIterable_When_AnnotationIsMissing() {
Supplier<DynamicContainer> supplier =
() ->
dynamicContainer("dynamic container", Stream.of(NULL_DYNAMIC_TEST, NULL_DYNAMIC_TEST));
return Stream.generate(supplier).limit(2).collect(Collectors.toList());
}
@WithAccessId(user = INSIDE_DYNAMIC_TEST_USER)
@TestFactory
Iterable<DynamicContainer>
should_SetAccessIdForDynamicContainerInIterable_When_AnnotationExists() {
Supplier<DynamicContainer> supplier =
() ->
dynamicContainer(
"dynamic container",
Stream.of(DYNAMIC_TEST_USER_DYNAMIC_TEST, DYNAMIC_TEST_USER_DYNAMIC_TEST));
return Stream.generate(supplier).limit(2).collect(Collectors.toList());
}
@WithAccessId(user = INSIDE_DYNAMIC_TEST_USER)
@WithAccessId(user = INSIDE_DYNAMIC_TEST_USER)
@TestFactory
Iterable<DynamicContainer>
should_SetMultipleAccessIdForDynamicContainerInIterable_When_AnnotationsExist() {
Supplier<DynamicContainer> supplier =
() ->
dynamicContainer(
"dynamic container", Stream.of(NOT_NULL_DYNAMIC_TEST, NOT_NULL_DYNAMIC_TEST));
return Stream.generate(supplier).limit(2).collect(Collectors.toList());
}
@TestFactory
Iterable<DynamicContainer>
should_NotSetAccessIdForNestedDynamicContainerInIterable_When_AnnotationIsMissing() {
Supplier<DynamicContainer> supplier =
() -> dynamicContainer("inside container", Stream.of(NULL_DYNAMIC_TEST, NULL_DYNAMIC_TEST));
Supplier<DynamicContainer> outsideSupplier =
() -> dynamicContainer("outside container", Stream.of(supplier.get(), NULL_DYNAMIC_TEST));
return Stream.generate(outsideSupplier).limit(2).collect(Collectors.toList());
}
@WithAccessId(user = INSIDE_DYNAMIC_TEST_USER)
@TestFactory
Iterable<DynamicContainer>
should_SetAccessIdForNestedDynamicContainerInIterable_When_AnnotationExists() {
Supplier<DynamicContainer> supplier =
() ->
dynamicContainer(
"inside container",
Stream.of(DYNAMIC_TEST_USER_DYNAMIC_TEST, DYNAMIC_TEST_USER_DYNAMIC_TEST));
Supplier<DynamicContainer> outsideSupplier =
() ->
dynamicContainer(
"outside container", Stream.of(supplier.get(), DYNAMIC_TEST_USER_DYNAMIC_TEST));
return Stream.generate(outsideSupplier).limit(2).collect(Collectors.toList());
}
@WithAccessId(user = INSIDE_DYNAMIC_TEST_USER)
@WithAccessId(user = INSIDE_DYNAMIC_TEST_USER)
@TestFactory
Iterable<DynamicContainer>
should_SetMultipleAccessIdForNestedDynamicContainerInIterable_When_AnnotationsExist() {
Supplier<DynamicContainer> supplier =
() ->
dynamicContainer(
"inside container", Stream.of(NOT_NULL_DYNAMIC_TEST, NOT_NULL_DYNAMIC_TEST));
Supplier<DynamicContainer> outsideSupplier =
() ->
dynamicContainer("outside container", Stream.of(supplier.get(), NOT_NULL_DYNAMIC_TEST));
return Stream.generate(outsideSupplier).limit(2).collect(Collectors.toList());
}
@TestFactory
Iterator<DynamicContainer>
should_NotSetAccessIdForDynamicContainerInIterator_When_AnnotationIsMissing() {
Supplier<DynamicContainer> supplier =
() ->
dynamicContainer("dynamic container", Stream.of(NULL_DYNAMIC_TEST, NULL_DYNAMIC_TEST));
return Stream.generate(supplier).limit(2).iterator();
}
@WithAccessId(user = INSIDE_DYNAMIC_TEST_USER)
@TestFactory
Iterator<DynamicContainer>
should_SetAccessIdForDynamicContainerInIterator_When_AnnotationExists() {
Supplier<DynamicContainer> supplier =
() ->
dynamicContainer(
"dynamic container",
Stream.of(DYNAMIC_TEST_USER_DYNAMIC_TEST, DYNAMIC_TEST_USER_DYNAMIC_TEST));
return Stream.generate(supplier).limit(2).iterator();
}
@WithAccessId(user = INSIDE_DYNAMIC_TEST_USER)
@WithAccessId(user = INSIDE_DYNAMIC_TEST_USER)
@TestFactory
Iterator<DynamicContainer>
should_SetMultipleAccessIdForDynamicContainerInIterator_When_AnnotationsExist() {
Supplier<DynamicContainer> supplier =
() ->
dynamicContainer(
"dynamic container", Stream.of(NOT_NULL_DYNAMIC_TEST, NOT_NULL_DYNAMIC_TEST));
return Stream.generate(supplier).limit(2).iterator();
}
@TestFactory
Iterator<DynamicContainer>
should_NotSetAccessIdForNestedDynamicContainerInIterator_When_AnnotationIsMissing() {
Supplier<DynamicContainer> supplier =
() -> dynamicContainer("inside container", Stream.of(NULL_DYNAMIC_TEST, NULL_DYNAMIC_TEST));
Supplier<DynamicContainer> outsideSupplier =
() -> dynamicContainer("outside container", Stream.of(supplier.get(), NULL_DYNAMIC_TEST));
return Stream.generate(outsideSupplier).limit(2).iterator();
}
@WithAccessId(user = INSIDE_DYNAMIC_TEST_USER)
@TestFactory
Iterator<DynamicContainer>
should_SetAccessIdForNestedDynamicContainerInIterator_When_AnnotationExists() {
Supplier<DynamicContainer> supplier =
() ->
dynamicContainer(
"inside container",
Stream.of(DYNAMIC_TEST_USER_DYNAMIC_TEST, DYNAMIC_TEST_USER_DYNAMIC_TEST));
Supplier<DynamicContainer> outsideSupplier =
() ->
dynamicContainer(
"outside container", Stream.of(supplier.get(), DYNAMIC_TEST_USER_DYNAMIC_TEST));
return Stream.generate(outsideSupplier).limit(2).iterator();
}
@WithAccessId(user = INSIDE_DYNAMIC_TEST_USER)
@WithAccessId(user = INSIDE_DYNAMIC_TEST_USER)
@TestFactory
Iterator<DynamicContainer>
should_SetMultipleAccessIdForNestedDynamicContainerInIterator_When_AnnotationsExist() {
Supplier<DynamicContainer> supplier =
() ->
dynamicContainer(
"inside container", Stream.of(NOT_NULL_DYNAMIC_TEST, NOT_NULL_DYNAMIC_TEST));
Supplier<DynamicContainer> outsideSupplier =
() ->
dynamicContainer("outside container", Stream.of(supplier.get(), NOT_NULL_DYNAMIC_TEST));
return Stream.generate(outsideSupplier).limit(2).iterator();
}
@TestFactory
DynamicContainer[] should_NotSetAccessIdForDynamicContainerInArray_When_AnnotationIsMissing() {
Supplier<DynamicContainer> supplier =
() ->
dynamicContainer("dynamic container", Stream.of(NULL_DYNAMIC_TEST, NULL_DYNAMIC_TEST));
return Stream.generate(supplier).limit(2).toArray(DynamicContainer[]::new);
}
@WithAccessId(user = INSIDE_DYNAMIC_TEST_USER)
@TestFactory
DynamicContainer[] should_SetAccessIdForDynamicContainerInArray_When_AnnotationExists() {
Supplier<DynamicContainer> supplier =
() ->
dynamicContainer(
"dynamic container",
Stream.of(DYNAMIC_TEST_USER_DYNAMIC_TEST, DYNAMIC_TEST_USER_DYNAMIC_TEST));
return Stream.generate(supplier).limit(2).toArray(DynamicContainer[]::new);
}
@WithAccessId(user = INSIDE_DYNAMIC_TEST_USER)
@WithAccessId(user = INSIDE_DYNAMIC_TEST_USER)
@TestFactory
DynamicContainer[] should_SetMultipleAccessIdForDynamicContainerInArray_When_AnnotationsExist() {
Supplier<DynamicContainer> supplier =
() ->
dynamicContainer(
"dynamic container", Stream.of(NOT_NULL_DYNAMIC_TEST, NOT_NULL_DYNAMIC_TEST));
return Stream.generate(supplier).limit(2).toArray(DynamicContainer[]::new);
}
@TestFactory
DynamicContainer[]
should_NotSetAccessIdForNestedDynamicContainerInArray_When_AnnotationIsMissing() {
Supplier<DynamicContainer> supplier =
() -> dynamicContainer("inside container", Stream.of(NULL_DYNAMIC_TEST, NULL_DYNAMIC_TEST));
Supplier<DynamicContainer> outsideSupplier =
() -> dynamicContainer("outside container", Stream.of(supplier.get(), NULL_DYNAMIC_TEST));
return Stream.generate(outsideSupplier).limit(2).toArray(DynamicContainer[]::new);
}
@WithAccessId(user = INSIDE_DYNAMIC_TEST_USER)
@TestFactory
DynamicContainer[] should_SetAccessIdForNestedDynamicContainerInArray_When_AnnotationExists() {
Supplier<DynamicContainer> supplier =
() ->
dynamicContainer(
"inside container",
Stream.of(DYNAMIC_TEST_USER_DYNAMIC_TEST, DYNAMIC_TEST_USER_DYNAMIC_TEST));
Supplier<DynamicContainer> outsideSupplier =
() ->
dynamicContainer(
"outside container", Stream.of(supplier.get(), DYNAMIC_TEST_USER_DYNAMIC_TEST));
return Stream.generate(outsideSupplier).limit(2).toArray(DynamicContainer[]::new);
}
@WithAccessId(user = INSIDE_DYNAMIC_TEST_USER)
@WithAccessId(user = INSIDE_DYNAMIC_TEST_USER)
@TestFactory
DynamicContainer[]
should_SetMultipleAccessIdForNestedDynamicContainerInArray_When_AnnotationsExist() {
Supplier<DynamicContainer> supplier =
() ->
dynamicContainer(
"inside container", Stream.of(NOT_NULL_DYNAMIC_TEST, NOT_NULL_DYNAMIC_TEST));
Supplier<DynamicContainer> outsideSupplier =
() ->
dynamicContainer("outside container", Stream.of(supplier.get(), NOT_NULL_DYNAMIC_TEST));
return Stream.generate(outsideSupplier).limit(2).toArray(DynamicContainer[]::new);
}