类org.junit.jupiter.api.DynamicNode源码实例Demo

下面列出了怎么用org.junit.jupiter.api.DynamicNode的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: sdn-rx   文件: Neo4jConversionsIT.java
@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));
		});
}
 
源代码2 项目: jhdf   文件: ByteShuffleChunkedDatasetTest.java
@TestFactory
Collection<DynamicNode> compressedChunkedDatasetReadTests() {
	// List of all the datasetPaths
	return Arrays.asList(
			dynamicContainer(HDF5_TEST_EARLIEST_FILE_NAME, Arrays.asList(
				dynamicTest("float32", createTest(earliestHdfFile,"/float/float32")),
				dynamicTest("float64", createTest(earliestHdfFile,"/float/float64")),
				dynamicTest("int8", createTest(earliestHdfFile,"/int/int8")),
				dynamicTest("int16", createTest(earliestHdfFile,"/int/int16")),
				dynamicTest("int32", createTest(earliestHdfFile,"/int/int32")))),

			dynamicContainer(HDF5_TEST_LATEST_FILE_NAME, Arrays.asList(
					dynamicTest("float32", createTest(latestHdfFile, "/float/float32")),
					dynamicTest("float64", createTest(latestHdfFile,"/float/float64")),
					dynamicTest("int8", createTest(latestHdfFile,"/int/int8")),
					dynamicTest("int16", createTest(latestHdfFile,"/int/int16")),
					dynamicTest("int32", createTest(latestHdfFile,"/int/int32")))));
}
 
源代码3 项目: jhdf   文件: CompressedChunkedDatasetTest.java
@TestFactory
Collection<DynamicNode> compressedChunkedDatasetReadTests() {
	// List of all the datasetPaths
	return Arrays.asList(
			dynamicContainer(HDF5_TEST_EARLIEST_FILE_NAME, Arrays.asList(
					dynamicTest("float32", createTest(earliestHdfFile,"/float/float32")),
					dynamicTest("float64", createTest(earliestHdfFile,"/float/float64")),
					dynamicTest("int8", createTest(earliestHdfFile,"/int/int8")),
					dynamicTest("int16", createTest(earliestHdfFile,"/int/int16")),
					dynamicTest("int32", createTest(earliestHdfFile,"/int/int32")))),

			dynamicContainer(HDF5_TEST_LATEST_FILE_NAME, Arrays.asList(
					dynamicTest("float32", createTest(latestHdfFile, "/float/float32")),
					dynamicTest("float64", createTest(latestHdfFile,"/float/float64")),
					dynamicTest("int8", createTest(latestHdfFile,"/int/int8")),
					dynamicTest("int16", createTest(latestHdfFile,"/int/int16")),
					dynamicTest("int32", createTest(latestHdfFile,"/int/int32")))));
}
 
源代码4 项目: jhdf   文件: ChunkedDatasetTest.java
@TestFactory
Collection<DynamicNode> chunkedDatasetReadTests() {
	// List of all the datasetPaths
	return Arrays.asList(
			dynamicContainer(HDF5_TEST_EARLIEST_FILE_NAME, Arrays.asList(
					dynamicTest("float16", createTest(earliestHdfFile, "/float/float16")),
					dynamicTest("float32", createTest(earliestHdfFile, "/float/float32")),
					dynamicTest("float64", createTest(earliestHdfFile, "/float/float64")),
					dynamicTest("int8", createTest(earliestHdfFile, "/int/int8")),
					dynamicTest("int16", createTest(earliestHdfFile, "/int/int16")),
					dynamicTest("int32", createTest(earliestHdfFile, "/int/int32")))),

			dynamicContainer(HDF5_TEST_EARLIEST_FILE_NAME, Arrays.asList(
					dynamicTest("float16", createTest(latestHdfFile, "/float/float16")),
					dynamicTest("float32", createTest(latestHdfFile, "/float/float32")),
					dynamicTest("float64", createTest(latestHdfFile, "/float/float64")),
					dynamicTest("int8", createTest(latestHdfFile, "/int/int8")),
					dynamicTest("int16", createTest(latestHdfFile, "/int/int16")),
					dynamicTest("int32", createTest(latestHdfFile, "/int/int32"))))
	);
}
 
源代码5 项目: jhdf   文件: FloatSpecialValuesTest.java
@TestFactory
Collection<DynamicNode> specialFloatValuesTests() {
    // List of all the datasetPaths
    return Arrays.asList(
            dynamicContainer("earliest", Arrays.asList(
                    dynamicTest("float16",
                            testFloat(earliestHdfFile, "float16")),
                    dynamicTest("float32",
                            testFloat(earliestHdfFile, "float32")),
                    dynamicTest("float64",
                            testDouble(earliestHdfFile, "float64")))),

            dynamicContainer("latest", Arrays.asList(
                    dynamicTest("float16",
                            testFloat(latestHdfFile, "float16")),
                    dynamicTest("float32",
                            testFloat(latestHdfFile, "float32")),
                    dynamicTest("float64",
                            testDouble(latestHdfFile, "float64")))));
}
 
源代码6 项目: jhdf   文件: StringDatasetTest.java
@TestFactory
Collection<DynamicNode> stringDataset1DTests() {
	// List of all the datasetPaths
	return Arrays.asList(
			dynamicContainer("earliest", Arrays.asList(
					dynamicTest("fixed ASCII",
							createTest(earliestHdfFile, "/fixed_length_ascii")),
					dynamicTest("fixed ASCII 1 char",
							createTest(earliestHdfFile, "/fixed_length_ascii_1_char")),
					dynamicTest("variable ASCII",
							createTest(earliestHdfFile, "/variable_length_ascii")),
					dynamicTest("variable UTF8",
							createTest(earliestHdfFile, "/variable_length_utf8")))),

			dynamicContainer("latest", Arrays.asList(
					dynamicTest("fixed ASCII",
							createTest(latestHdfFile, "/fixed_length_ascii")),
					dynamicTest("fixed ASCII 1 char",
							createTest(latestHdfFile, "/fixed_length_ascii_1_char")),
					dynamicTest("variable ASCII",
							createTest(latestHdfFile, "/variable_length_ascii")),
					dynamicTest("variable UTF8",
							createTest(latestHdfFile, "/variable_length_utf8")))));
}
 
源代码7 项目: jhdf   文件: TestAllFiles.java
@TestFactory
Stream<DynamicNode> allHdf5TestFiles() throws IOException, URISyntaxException {

	// Auto discover the test files assuming they exist in under the directory
	// containing test_file.hdf5
	URL resource = this.getClass().getResource("/hdf5/");
	Path path = Paths.get(resource.toURI()).getParent();
	List<Path> files = Files.walk(path).filter(HDF5::matches).collect(Collectors.toList());

	// Check at least some files have been discovered
	assertThat("Less than 3 HDF5 test files discovered searched paths below: " + path.toAbsolutePath(),
			files.size(), is(greaterThan(2)));

	// Make a test for each file
	return files.stream().map(this::createTest);
}
 
源代码8 项目: jhdf   文件: DatasetByAddressTest.java
@TestFactory
Collection<DynamicNode> scalarDatasetTests() {
	// List of all the datasetPaths
	return Collections.singletonList(
			dynamicContainer("earliest", Arrays.asList(
					dynamicTest("fixed ASCII",
							createTest(earliestHdfFile, 800)),
					dynamicTest("fixed ASCII 1 char",
							createTest(earliestHdfFile, 1400)),
					dynamicTest("variable ASCII",
							createTest(earliestHdfFile, 1672)),
					dynamicTest("variable UTF8",
							createTest(earliestHdfFile, 6654)))));

}
 
源代码9 项目: jhdf   文件: OddDatasetTest.java
@TestFactory
Collection<DynamicNode> compressedChunkedDatasetReadTests() {
	// List of all the datasetPaths
	return Arrays.asList(
			dynamicContainer(HDF5_TEST_EARLIEST_FILE_NAME, Arrays.asList(
					dynamicTest("8D_int16", createTest(earliestHdfFile, "/8D_int16")),
					dynamicTest("1D_int16", createTest(earliestHdfFile, "/1D_int16")))),

			dynamicContainer(HDF5_TEST_LATEST_FILE_NAME, Arrays.asList(
					dynamicTest("8D_int16", createTest(latestHdfFile, "/8D_int16")),
					dynamicTest("1D_int16", createTest(latestHdfFile, "/1D_int16"))))
			);
}
 
源代码10 项目: jhdf   文件: ChunkedV4DatasetTest.java
@TestFactory
Stream<DynamicNode> verifyDatasets() {
    List<Dataset> datasets = new ArrayList<>();
    getAllDatasets(hdfFile, datasets);

    return datasets.stream().map(this::verifyDataset);
}
 
源代码11 项目: jhdf   文件: FillValueDatasetTest.java
@TestFactory
Collection<DynamicNode> fillValueTests() {
	// List of all the datasetPaths
	return Arrays.asList(
			dynamicContainer("earliest", Arrays.asList(
					dynamicTest("float32",
							createTest(earliestHdfFile, "float/float32", float.class, 33.33f)),
					dynamicTest("float64",
							createTest(earliestHdfFile, "float/float64", double.class, 123.456)),
					dynamicTest("int8",
							createTest(earliestHdfFile, "int/int8", byte.class, (byte) 8)),
					dynamicTest("int16",
							createTest(earliestHdfFile, "int/int16", short.class, (short) 16)),
					dynamicTest("int32",
							createTest(earliestHdfFile, "int/int32", int.class, 32)),
					dynamicTest("int64",
							createTest(earliestHdfFile, "no_fill", byte.class, null)))),

			dynamicContainer("latest", Arrays.asList(
					dynamicTest("float32",
							createTest(latestHdfFile, "float/float32", float.class, 33.33f)),
					dynamicTest("float64",
							createTest(latestHdfFile, "float/float64", double.class, 123.456)),
					dynamicTest("int8",
							createTest(latestHdfFile, "int/int8", byte.class, (byte) 8)),
					dynamicTest("int16",
							createTest(latestHdfFile, "int/int16", short.class, (short) 16)),
					dynamicTest("int32",
							createTest(latestHdfFile, "int/int32", int.class, 32)),
					dynamicTest("int64",
							createTest(latestHdfFile, "no_fill", byte.class, null)))));
}
 
源代码12 项目: jhdf   文件: VariableLengthDatasetTest.java
@TestFactory
Collection<DynamicNode> compressedChunkedDatasetReadTests() {
	// List of all the datasetPaths
	return Arrays.asList(
			dynamicContainer(HDF5_TEST_EARLIEST_FILE_NAME, Arrays.asList(
					dynamicTest("float32", createTest(earliestHdfFile,"vlen_float32_data")),
					dynamicTest("float32 - chunked", createTest(earliestHdfFile,"vlen_float32_data_chunked")),
					dynamicTest("float64", createTest(earliestHdfFile,"vlen_float64_data")),
					dynamicTest("float64 - chunked", createTest(earliestHdfFile,"vlen_float64_data_chunked")),
					dynamicTest("uint8", createTest(earliestHdfFile,"vlen_uint8_data")),
					dynamicTest("uint8 - chunked", createTest(earliestHdfFile,"vlen_uint8_data_chunked")),
					dynamicTest("uint16", createTest(earliestHdfFile,"vlen_uint16_data")),
					dynamicTest("uint16 - chunked", createTest(earliestHdfFile,"vlen_uint16_data_chunked")),
					dynamicTest("uint32", createTest(earliestHdfFile,"vlen_uint32_data")),
					dynamicTest("uint32 - chunked", createTest(earliestHdfFile,"vlen_uint32_data_chunked")),
					dynamicTest("uint64", createTest(earliestHdfFile,"vlen_uint64_data")),
					dynamicTest("uint64 - chunked", createTest(earliestHdfFile,"vlen_uint64_data_chunked")))),

			dynamicContainer(HDF5_TEST_LATEST_FILE_NAME, Arrays.asList(
					dynamicTest("float32", createTest(latestHdfFile,"vlen_float32_data")),
					dynamicTest("float32 - chunked", createTest(latestHdfFile,"vlen_float32_data_chunked")),
					dynamicTest("float64", createTest(latestHdfFile,"vlen_float64_data")),
					dynamicTest("float64 - chunked", createTest(latestHdfFile,"vlen_float64_data_chunked")),
					dynamicTest("uint8", createTest(latestHdfFile,"vlen_uint8_data")),
					dynamicTest("uint8 - chunked", createTest(latestHdfFile,"vlen_uint8_data_chunked")),
					dynamicTest("uint16", createTest(latestHdfFile,"vlen_uint16_data")),
					dynamicTest("uint16 - chunked", createTest(latestHdfFile,"vlen_uint16_data_chunked")),
					dynamicTest("uint32", createTest(latestHdfFile,"vlen_uint32_data")),
					dynamicTest("uint32 - chunked", createTest(latestHdfFile,"vlen_uint32_data_chunked")),
					dynamicTest("uint64", createTest(latestHdfFile,"vlen_uint64_data")),
					dynamicTest("uint64 - chunked", createTest(latestHdfFile,"vlen_uint64_data_chunked")))));
}
 
源代码13 项目: jhdf   文件: EnumDatasetTest.java
@TestFactory
Stream<DynamicNode> earliest() {
    List<Dataset> datasets = new ArrayList<>();
    getAllDatasets(earliestHdfFile, datasets);

    return datasets.stream().map(this::verifyDataset);
}
 
源代码14 项目: jhdf   文件: EnumDatasetTest.java
@TestFactory
Stream<DynamicNode> latest() {
    List<Dataset> datasets = new ArrayList<>();
    getAllDatasets(latestHdfFile, datasets);

    return datasets.stream().map(this::verifyDataset);
}
 
源代码15 项目: jhdf   文件: TestAllFiles.java
private DynamicNode createTest(Path path) {
	return dynamicTest(path.getFileName().toString(), () -> {
		try (HdfFile hdfFile = new HdfFile(path.toFile())) {
			verifyAttributes(hdfFile);
			recurseGroup(hdfFile);
		}
	});
}
 
源代码16 项目: jhdf   文件: FixedPointTest.java
@TestFactory
       Stream<DynamicNode> datasetReadTests() {
	return Stream.of(
	        dynamicTest("Signed Byte", createTest(byteBuffer, byteDataType, dims, byteResult)),
			dynamicTest("Unsigned Byte", createTest(byteBuffer, unsignedByteDataType, dims, unsignedByteResult)),
			dynamicTest("Signed Short", createTest(shortBuffer, shortDataType, dims, shortResult)),
			dynamicTest("Unsigned Short", createTest(shortBuffer, unsignedShortDataType, dims, unsignedShortResult)),
			dynamicTest("Signed Int", createTest(intBuffer, intDataType, dims, intResult)),
			dynamicTest("Unsigned Int", createTest(intBuffer, unsignedIntDataType, dims, unsignedIntResult)),
			dynamicTest("Signed Long", createTest(longBuffer, longDataType, dims, longResult)),
			dynamicTest("Unsigned Long", createTest(longBuffer, unsignedLongDataType, dims, unsignedLongResult)));
}
 
源代码17 项目: javatech   文件: DynamicTests.java
@TestFactory
Stream<DynamicNode> dynamicTestsWithContainers() {
    return Stream
        .of("A", "B", "C").map(
            input -> dynamicContainer("Container " + input, Stream
                .of(dynamicTest("not null", () -> assertNotNull(input)),
                    dynamicContainer("properties",
                        Stream.of(
                            dynamicTest("length > 0",
                                () -> assertTrue(input
                                    .length() > 0)),
                            dynamicTest("not empty",
                                () -> assertFalse(input
                                    .isEmpty())))))));
}
 
源代码18 项目: taskana   文件: WorkingDaysToDaysConverterTest.java
@TestFactory
Stream<DynamicNode> should_DetectCorpusChristiAsHoliday_When_CorpusChristiIsEnabled() {
  WorkingDaysToDaysConverter converter = new WorkingDaysToDaysConverter(true, true);
  DynamicTest year1980 =
      DynamicTest.dynamicTest(
          "year 1980",
          () -> assertThat(converter.isGermanHoliday(LocalDate.parse("1980-06-05"))).isTrue());
  DynamicTest year2020 =
      DynamicTest.dynamicTest(
          "year 2020",
          () -> assertThat(converter.isGermanHoliday(LocalDate.parse("2020-06-11"))).isTrue());
  return Stream.of(year1980, year2020);
}
 
源代码19 项目: taskana   文件: JaasExtension.java
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);
        }
      });
}
 
源代码20 项目: taskana   文件: JaasExtension.java
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;
}
 
源代码21 项目: robozonky   文件: EqualityConditionTest.java
@TestFactory
Stream<DynamicNode> ratings() {
    return Stream.of(Rating.values())
        .map(rating -> dynamicContainer(rating.getCode(), Stream.of(
                dynamicContainer("is better than", betterThan(rating)),
                dynamicContainer("is worse than", worseThan(rating)))));
}
 
@TestFactory
Stream<DynamicNode> conditions() {
    return Stream.of(new BorrowerIncomeConditionSpec(), new BorrowerRegionConditionSpec(),
            new LoanPurposeConditionSpec(), new LoanRatingEnumeratedConditionSpec(),
            new HealthConditionSpec())
        .map(spec -> dynamicContainer(spec.getImplementation()
            .getClass()
            .getSimpleName(), forSpec(spec)));
}
 
源代码23 项目: demo-junit-5   文件: ArithmeticTreeTest.java
private static DynamicNode generateTestTreeFor(
		ArithmeticNode arithmeticNode, ArithmeticTreeTestData treeTestData) {
	var testForNode = generateTestFor(arithmeticNode, treeTestData);
	if (arithmeticNode.operands().isEmpty())
		return testForNode;
	else {
		var testsForChildren = generateTestsFor(arithmeticNode.operands(), treeTestData);
		var expected = treeTestData.resultFor(arithmeticNode);
		var testName = arithmeticNode + " should evaluate to " + expected + " (ops '+3' and '*10' fail)";
		return dynamicContainer(testName, concat(of(testForNode), testsForChildren));
	}
}
 
源代码24 项目: sdn-rx   文件: TypeConversionIT.java
@TestFactory
Stream<DynamicNode> conversionsShouldBeAppliedToEntities() {

	Map<String, Map<String, Object>> supportedTypes = new HashMap<>();
	supportedTypes.put("CypherTypes", CYPHER_TYPES);
	supportedTypes.put("AdditionalTypes", ADDITIONAL_TYPES);
	supportedTypes.put("SpatialTypes", SPATIAL_TYPES);
	supportedTypes.put("CustomTypes", CUSTOM_TYPES);

	return supportedTypes.entrySet().stream()
		.map(entry -> {

			Object thing;
			Object copyOfThing;
			switch (entry.getKey()) {
				case "CypherTypes":
					ThingWithAllCypherTypes hlp = cypherTypesRepository.findById(ID_OF_CYPHER_TYPES_NODE).get();
					copyOfThing = cypherTypesRepository.save(hlp.withId(null));
					thing = hlp;
					break;
				case "AdditionalTypes":
					ThingWithAllAdditionalTypes hlp2 = additionalTypesRepository
						.findById(ID_OF_ADDITIONAL_TYPES_NODE).get();
					copyOfThing = additionalTypesRepository.save(hlp2.withId(null));
					thing = hlp2;
					break;
				case "SpatialTypes":
					ThingWithAllSpatialTypes hlp3 = spatialTypesRepository.findById(ID_OF_SPATIAL_TYPES_NODE)
						.get();
					copyOfThing = spatialTypesRepository.save(hlp3.withId(null));
					thing = hlp3;
					break;
				case "CustomTypes":
					ThingWithCustomTypes hlp4 = customTypesRepository.findById(ID_OF_CUSTOM_TYPE_NODE)
						.get();
					copyOfThing = customTypesRepository.save(hlp4.withId(null));
					thing = hlp4;
					break;
				default:
					throw new UnsupportedOperationException("Unsupported types: " + entry.getKey());
			}

			DynamicContainer reads = DynamicContainer.dynamicContainer("read", entry.getValue().entrySet().stream()
				.map(a -> dynamicTest(a.getKey(),
					() -> assertThat(ReflectionTestUtils.getField(thing, a.getKey())).isEqualTo(a.getValue()))));

			DynamicContainer writes = DynamicContainer
				.dynamicContainer("write", entry.getValue().entrySet().stream()
					.map(a -> dynamicTest(a.getKey(),
						() -> assertWrite(copyOfThing, a.getKey(), defaultConversionService))));

			return DynamicContainer.dynamicContainer(entry.getKey(), Arrays.asList(reads, writes));
		});
}
 
源代码25 项目: jhdf   文件: ScalarDatasetTest.java
@TestFactory
Collection<DynamicNode> scalarDatasetTests() {
	// List of all the datasetPaths
	return Arrays.asList(
			dynamicContainer("earliest", Arrays.asList(
					dynamicTest("float32",
							createTest(earliestHdfFile, "scalar_float_32", 123.45f)),
					dynamicTest("float64",
							createTest(earliestHdfFile, "scalar_float_64", 123.45d)),
					dynamicTest("int8",
							createTest(earliestHdfFile, "scalar_int_8", (byte) 123)),
					dynamicTest("int16",
							createTest(earliestHdfFile, "scalar_int_16", (short) 123)),
					dynamicTest("int32",
							createTest(earliestHdfFile, "scalar_int_32", 123)),
					dynamicTest("int64",
							createTest(earliestHdfFile, "scalar_int_64", (long) 123)),
					dynamicTest("uint8",
							createTest(earliestHdfFile, "scalar_uint_8", 123)),
					dynamicTest("uint16",
							createTest(earliestHdfFile, "scalar_uint_16", 123)),
					dynamicTest("uint32",
							createTest(earliestHdfFile, "scalar_uint_32", (long) 123)),
					dynamicTest("uint64",
							createTest(earliestHdfFile, "scalar_uint_64", BigInteger.valueOf(123))),
					dynamicTest("string",
							createTest(earliestHdfFile, "scalar_string", "hello")))),

			dynamicContainer("latest", Arrays.asList(
					dynamicTest("float32",
							createTest(latestHdfFile, "scalar_float_32", 123.45f)),
					dynamicTest("float64",
							createTest(latestHdfFile, "scalar_float_64", 123.45d)),
					dynamicTest("int8",
							createTest(latestHdfFile, "scalar_int_8", (byte) 123)),
					dynamicTest("int16",
							createTest(latestHdfFile, "scalar_int_16", (short) 123)),
					dynamicTest("int32",
							createTest(latestHdfFile, "scalar_int_32", 123)),
					dynamicTest("int64",
							createTest(latestHdfFile, "scalar_int_64", (long) 123)),
					dynamicTest("uint8",
							createTest(latestHdfFile, "scalar_uint_8", 123)),
					dynamicTest("uint16",
							createTest(latestHdfFile, "scalar_uint_16", 123)),
					dynamicTest("uint32",
							createTest(latestHdfFile, "scalar_uint_32", (long) 123)),
					dynamicTest("uint64",
							createTest(latestHdfFile, "scalar_uint_64", BigInteger.valueOf(123))),
					dynamicTest("string",
							createTest(latestHdfFile, "scalar_string", "hello")))));
}
 
源代码26 项目: jhdf   文件: EmptyDatasetTest.java
@TestFactory
Collection<DynamicNode> emptyDatasetTests() {
	// List of all the datasetPaths
	return Arrays.asList(
			dynamicContainer("earliest", Arrays.asList(
					dynamicTest("float32",
							createTest(earliestHdfFile, "empty_float_32", Float.class)),
					dynamicTest("float64",
							createTest(earliestHdfFile, "empty_float_64", Double.class)),
					dynamicTest("int8",
							createTest(earliestHdfFile, "empty_int_8", Byte.class)),
					dynamicTest("int16",
							createTest(earliestHdfFile, "empty_int_16", Short.class)),
					dynamicTest("int32",
							createTest(earliestHdfFile, "empty_int_32", Integer.class)),
					dynamicTest("int64",
							createTest(earliestHdfFile, "empty_int_64", Long.class)),
					dynamicTest("uint8",
							createTest(earliestHdfFile, "empty_uint_8", Integer.class)),
					dynamicTest("uint16",
							createTest(earliestHdfFile, "empty_uint_16", Integer.class)),
					dynamicTest("uint32",
							createTest(earliestHdfFile, "empty_uint_32", Long.class)),
					dynamicTest("uint64",
							createTest(earliestHdfFile, "empty_uint_64", BigInteger.class)),
					dynamicTest("string",
							createTest(earliestHdfFile, "empty_string", String.class)))),

			dynamicContainer("latest", Arrays.asList(
					dynamicTest("float32",
							createTest(latestHdfFile, "empty_float_32", Float.class)),
					dynamicTest("float64",
							createTest(latestHdfFile, "empty_float_64", Double.class)),
					dynamicTest("int8",
							createTest(latestHdfFile, "empty_int_8", Byte.class)),
					dynamicTest("int16",
							createTest(latestHdfFile, "empty_int_16", Short.class)),
					dynamicTest("int32",
							createTest(latestHdfFile, "empty_int_32", Integer.class)),
					dynamicTest("int64",
							createTest(latestHdfFile, "empty_int_64", Long.class)),
					dynamicTest("uint8",
							createTest(latestHdfFile, "empty_uint_8", Integer.class)),
					dynamicTest("uint16",
							createTest(latestHdfFile, "empty_uint_16", Integer.class)),
					dynamicTest("uint32",
							createTest(latestHdfFile, "empty_uint_32", Long.class)),
					dynamicTest("uint64",
							createTest(latestHdfFile, "empty_uint_64", BigInteger.class)),
					dynamicTest("string",
							createTest(latestHdfFile, "empty_string", String.class)))));
}
 
源代码27 项目: jhdf   文件: LargeGroupTest.java
@TestFactory
Collection<DynamicNode> datasetReadTests() {
	return Arrays.asList(dynamicTest("earliest", createTest("test_large_group_earliest.hdf5")),
			dynamicTest("latest", createTest("test_large_group_latest.hdf5")));
}
 
源代码28 项目: jhdf   文件: FloatingPointTest.java
@TestFactory
Stream<DynamicNode> datasetReadTests() {
    return Stream.of(
dynamicTest("Float", createTest(floatBuffer, floatDataType, dims, floatResult)),
dynamicTest("Double", createTest(doubleBuffer, doubleDataType, dims, doubleResult)));
}
 
源代码29 项目: jhdf   文件: ReferenceTest.java
@TestFactory
   Collection<DynamicNode> datasetReadTests() {
	return Arrays.asList(
			dynamicTest("Reference8", createTest(longBuffer, referenceDataType, dims, longResult)),
			dynamicTest("Reference4", createTest(referenceIntBuffer, referenceDataTypeSmall, dims, referenceIntLongResult)));
}
 
源代码30 项目: taskana   文件: JaasExtension.java
@Override
@SuppressWarnings("unchecked")
public <T> T interceptTestFactoryMethod(
    Invocation<T> invocation,
    ReflectiveInvocationContext<Method> invocationContext,
    ExtensionContext extensionContext) {
  WithAccessIds annotation = invocationContext.getExecutable().getAnnotation(WithAccessIds.class);
  if (annotation != null) {
    // our goal is to run each test returned from the test factory X times. X is the amount of
    // WithAccessId annotations. In order to achieve this we are wrapping the result from the
    // factory (the returning tests) in a dynamicContainer for each accessId. Since we don't know
    // what the factory will return we have to check for every possible return type. All possible
    // return types can be found here:
    // https://junit.org/junit5/docs/current/user-guide/#writing-tests-dynamic-tests
    // After checking each return type we abuse the return type of T and hardly change it to
    // Stream<DynamicContainer> no matter what the factory returns. This return type is allowed
    // per definition (See link above), but is not the type T. Hence we have an unchecked cast at
    // the end to keep the compiler happy...

    // we are using the first annotation to run the factory method with.
    T factoryResult = performInvocationWithAccessId(invocation, annotation.value()[0]);

    Iterable<DynamicNode> newChildrenForDynamicContainer;
    // TestFactory must have one of the following return types. See link above for further details
    if (factoryResult instanceof DynamicNode) {
      newChildrenForDynamicContainer = Collections.singleton((DynamicNode) factoryResult);
    } else if (factoryResult instanceof Stream) {
      Stream<DynamicNode> nodes = (Stream<DynamicNode>) factoryResult;
      newChildrenForDynamicContainer = nodes.collect(Collectors.toList());
    } else if (factoryResult instanceof Iterable) {
      newChildrenForDynamicContainer = (Iterable<DynamicNode>) factoryResult;
    } else if (factoryResult instanceof Iterator) {
      newChildrenForDynamicContainer = () -> (Iterator<DynamicNode>) factoryResult;
    } else if (factoryResult instanceof DynamicNode[]) {
      newChildrenForDynamicContainer = Arrays.asList((DynamicNode[]) factoryResult);
    } else {
      throw new SystemException(
          String.format(
              "Testfactory '%s' did not return a proper type",
              invocationContext.getExecutable().getName()));
    }

    // Currently a DynamicContainer has children from this type: Stream<DynamicNode>
    // Because of this the children can only be extracted once (Streams can only be operated
    // once). This is obviously not ok since we want to execute each node X times. So we have to
    // manually persist all children recursively to extract them X times...
    Map<String, List<DynamicNode>> childrenMap = new HashMap<>();
    persistDynamicContainerChildren(newChildrenForDynamicContainer, childrenMap);

    Function<WithAccessId, DynamicContainer> wrapTestsInDynamicContainer =
        accessId ->
            DynamicContainer.dynamicContainer(
                getDisplayNameForAccessId(accessId),
                StreamSupport.stream(newChildrenForDynamicContainer.spliterator(), false)
                    .map(x -> duplicateDynamicNode(x, childrenMap)));

    Store store = getStore(extensionContext);
    return (T)
        Stream.of(annotation.value())
            .peek(a -> store.put(ACCESS_IDS_STORE_KEY, a))
            .map(wrapTestsInDynamicContainer);
  }

  return extractAccessIdAndPerformInvocation(invocation, invocationContext.getExecutable());
}
 
 类所在包
 同包方法