org.junit.jupiter.api.DynamicContainer Java Examples

The following examples show how to use org.junit.jupiter.api.DynamicContainer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Neo4jConversionsIT.java    From sdn-rx with Apache License 2.0 6 votes vote down vote up
@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));
		});
}
 
Example #2
Source File: DynamicContainerTest.java    From demo-junit-5 with Creative Commons Zero v1.0 Universal 6 votes vote down vote up
@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!")))
			)
	);
}
 
Example #3
Source File: JaasExtensionTest.java    From taskana with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example #4
Source File: SinksTest.java    From reactor-core with Apache License 2.0 5 votes vote down vote up
@TestFactory
Stream<DynamicContainer> checkSemantics() {
	return Stream.of(
			expectUnicast(supplier),
			expectBufferingBeforeFirstSubscriber(supplier, ALL)
	);
}
 
Example #5
Source File: JaasExtensionTest.java    From taskana with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example #6
Source File: JaasExtensionTest.java    From taskana with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example #7
Source File: JaasExtensionTest.java    From taskana with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example #8
Source File: JaasExtensionTest.java    From taskana with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example #9
Source File: JaasExtensionTest.java    From taskana with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example #10
Source File: JaasExtensionTest.java    From taskana with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example #11
Source File: JaasExtensionTest.java    From taskana with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example #12
Source File: JaasExtensionTest.java    From taskana with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example #13
Source File: JaasExtensionTest.java    From taskana with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example #14
Source File: JaasExtension.java    From taskana with Apache License 2.0 5 votes vote down vote up
private static void persistDynamicContainerChildren(
    Iterable<DynamicNode> nodes, Map<String, List<DynamicNode>> childrenMap) {
  nodes.forEach(
      node -> {
        if (node instanceof DynamicContainer) {
          DynamicContainer container = (DynamicContainer) node;
          List<DynamicNode> children = container.getChildren().collect(Collectors.toList());
          childrenMap.put(container.hashCode() + container.getDisplayName(), children);
          persistDynamicContainerChildren(children, childrenMap);
        }
      });
}
 
Example #15
Source File: JaasExtension.java    From taskana with Apache License 2.0 5 votes vote down vote up
private static DynamicNode duplicateDynamicNode(
    DynamicNode node, Map<String, List<DynamicNode>> lookupMap) {
  if (node instanceof DynamicContainer) {
    DynamicContainer container = (DynamicContainer) node;
    Stream<DynamicNode> children =
        lookupMap.get(node.hashCode() + node.getDisplayName()).stream()
            .map(x -> duplicateDynamicNode(x, lookupMap));
    return DynamicContainer.dynamicContainer(container.getDisplayName(), children);
  }
  return node;
}
 
Example #16
Source File: AbstractListenerTest.java    From robozonky with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
private <T extends Event> DynamicContainer forListener(final SupportedListener listener) {
    final AbstractTargetHandler p = getHandler();
    final AbstractListener<T> l = (AbstractListener<T>) getListener(listener, p);
    final T e = (T) listener.getSampleEvent();
    return DynamicContainer.dynamicContainer(listener.toString(), Stream.of(
            dynamicTest("is formally correct", () -> testFormal(l, e, listener)),
            dynamicTest("is processed as plain text", () -> testPlainTextProcessing(l, e)),
            dynamicTest("is processed as HTML", () -> testHtmlProcessing(l, e)),
            dynamicTest("triggers the sending code", () -> testTriggered(p, l, e)),
            dynamicTest("has listener enabled", () -> testListenerEnabled(e))));
}
 
Example #17
Source File: SinksTest.java    From reactor-core with Apache License 2.0 5 votes vote down vote up
@TestFactory
Stream<DynamicContainer> checkSemantics() {
	return Stream.of(
			expectMulticast(supplier),
			expectReplay(supplier, NONE),
			expectBufferingBeforeFirstSubscriber(supplier, NONE)
	);
}
 
Example #18
Source File: SinksTest.java    From reactor-core with Apache License 2.0 5 votes vote down vote up
@TestFactory
Stream<DynamicContainer> checkSemantics() {
	return Stream.of(
			expectMulticast(supplier),
			expectReplay(supplier, NONE),
			dynamicContainer("buffers all before 1st subscriber, except for errors",
					expectBufferingBeforeFirstSubscriber(supplier, ALL)
							.getChildren().filter(dn -> !dn.getDisplayName().equals("replayAndErrorFirstSubscriber")))
	);
}
 
Example #19
Source File: SinksTest.java    From reactor-core with Apache License 2.0 5 votes vote down vote up
@TestFactory
Stream<DynamicContainer> checkSemantics() {
	return Stream.of(
			expectMulticast(supplier),
			expectReplay(supplier, ALL),
			expectBufferingBeforeFirstSubscriber(supplier, ALL)
	);
}
 
Example #20
Source File: SinksTest.java    From reactor-core with Apache License 2.0 5 votes vote down vote up
@TestFactory
Stream<DynamicContainer> checkSemanticsSize5() {
	final int historySize = 5;
	final Supplier<Sinks.StandaloneFluxSink<Integer>> supplier = () -> Sinks.replay(historySize);

	return Stream.of(
			expectMulticast(supplier),
			expectReplay(supplier, historySize),
			expectBufferingBeforeFirstSubscriber(supplier, historySize)
	);
}
 
Example #21
Source File: SinksTest.java    From reactor-core with Apache License 2.0 5 votes vote down vote up
@TestFactory
Stream<DynamicContainer> checkSemanticsSize0() {
	final int historySize = 0;
	final Supplier<Sinks.StandaloneFluxSink<Integer>> supplier = () -> Sinks.replay(historySize);

	return Stream.of(
			expectMulticast(supplier),
			expectReplay(supplier, historySize),
			expectBufferingBeforeFirstSubscriber(supplier, historySize)
	);
}
 
Example #22
Source File: SinksTest.java    From reactor-core with Apache License 2.0 5 votes vote down vote up
@TestFactory
Stream<DynamicContainer> checkSemanticsSize100() {
	final int historySize = 100;
	final Supplier<Sinks.StandaloneFluxSink<Integer>> supplier = () -> Sinks.replay(historySize);

	return Stream.of(
			expectMulticast(supplier),
			expectReplay(supplier, historySize),
			expectBufferingBeforeFirstSubscriber(supplier, historySize)
	);
}
 
Example #23
Source File: JaasExtensionTest.java    From taskana with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example #24
Source File: JaasExtensionTest.java    From taskana with Apache License 2.0 5 votes vote down vote up
@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));
}
 
Example #25
Source File: JaasExtensionTest.java    From taskana with Apache License 2.0 5 votes vote down vote up
@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));
}
 
Example #26
Source File: JaasExtensionTest.java    From taskana with Apache License 2.0 5 votes vote down vote up
@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));
}
 
Example #27
Source File: JaasExtensionTest.java    From taskana with Apache License 2.0 5 votes vote down vote up
@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));
}
 
Example #28
Source File: JaasExtensionTest.java    From taskana with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example #29
Source File: JaasExtensionTest.java    From taskana with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example #30
Source File: JaasExtensionTest.java    From taskana with Apache License 2.0 5 votes vote down vote up
@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);
}