org.junit.jupiter.api.DynamicNode Java Examples
The following examples show how to use
org.junit.jupiter.api.DynamicNode.
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 |
@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: ByteShuffleChunkedDatasetTest.java From jhdf with MIT License | 6 votes |
@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"))))); }
Example #3
Source File: CompressedChunkedDatasetTest.java From jhdf with MIT License | 6 votes |
@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"))))); }
Example #4
Source File: ChunkedDatasetTest.java From jhdf with MIT License | 6 votes |
@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")))) ); }
Example #5
Source File: FloatSpecialValuesTest.java From jhdf with MIT License | 6 votes |
@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"))))); }
Example #6
Source File: StringDatasetTest.java From jhdf with MIT License | 6 votes |
@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"))))); }
Example #7
Source File: TestAllFiles.java From jhdf with MIT License | 6 votes |
@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); }
Example #8
Source File: AbstractEnumeratedConditionTest.java From robozonky with Apache License 2.0 | 5 votes |
@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))); }
Example #9
Source File: EqualityConditionTest.java From robozonky with Apache License 2.0 | 5 votes |
@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))))); }
Example #10
Source File: JaasExtension.java From taskana with Apache License 2.0 | 5 votes |
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 #11
Source File: JaasExtension.java From taskana with Apache License 2.0 | 5 votes |
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 #12
Source File: WorkingDaysToDaysConverterTest.java From taskana with Apache License 2.0 | 5 votes |
@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); }
Example #13
Source File: DynamicTests.java From javatech with Creative Commons Attribution Share Alike 4.0 International | 5 votes |
@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()))))))); }
Example #14
Source File: FixedPointTest.java From jhdf with MIT License | 5 votes |
@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))); }
Example #15
Source File: TestAllFiles.java From jhdf with MIT License | 5 votes |
private DynamicNode createTest(Path path) { return dynamicTest(path.getFileName().toString(), () -> { try (HdfFile hdfFile = new HdfFile(path.toFile())) { verifyAttributes(hdfFile); recurseGroup(hdfFile); } }); }
Example #16
Source File: EnumDatasetTest.java From jhdf with MIT License | 5 votes |
@TestFactory Stream<DynamicNode> latest() { List<Dataset> datasets = new ArrayList<>(); getAllDatasets(latestHdfFile, datasets); return datasets.stream().map(this::verifyDataset); }
Example #17
Source File: EnumDatasetTest.java From jhdf with MIT License | 5 votes |
@TestFactory Stream<DynamicNode> earliest() { List<Dataset> datasets = new ArrayList<>(); getAllDatasets(earliestHdfFile, datasets); return datasets.stream().map(this::verifyDataset); }
Example #18
Source File: VariableLengthDatasetTest.java From jhdf with MIT License | 5 votes |
@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"))))); }
Example #19
Source File: FillValueDatasetTest.java From jhdf with MIT License | 5 votes |
@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))))); }
Example #20
Source File: ChunkedV4DatasetTest.java From jhdf with MIT License | 5 votes |
@TestFactory Stream<DynamicNode> verifyDatasets() { List<Dataset> datasets = new ArrayList<>(); getAllDatasets(hdfFile, datasets); return datasets.stream().map(this::verifyDataset); }
Example #21
Source File: ArithmeticTreeTest.java From demo-junit-5 with Creative Commons Zero v1.0 Universal | 5 votes |
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)); } }
Example #22
Source File: OddDatasetTest.java From jhdf with MIT License | 5 votes |
@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")))) ); }
Example #23
Source File: DatasetByAddressTest.java From jhdf with MIT License | 5 votes |
@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))))); }
Example #24
Source File: ArithmeticTreeTest.java From demo-junit-5 with Creative Commons Zero v1.0 Universal | 4 votes |
private DynamicNode generateTestPlan(ArithmeticTreeTestData treeTestData) { return generateTestTreeFor(treeTestData.tree(), treeTestData); }
Example #25
Source File: ArithmeticTreeTest.java From demo-junit-5 with Creative Commons Zero v1.0 Universal | 4 votes |
@TestFactory DynamicNode testRandomArithmeticTree() { return generateTestPlan(ArithmeticTreeTestData.generateRandom()); }
Example #26
Source File: ArithmeticTreeTest.java From demo-junit-5 with Creative Commons Zero v1.0 Universal | 4 votes |
@TestFactory DynamicNode testArithmeticTree() { return generateTestPlan(ArithmeticTreeTestData.generate()); }
Example #27
Source File: AbstractListenerTest.java From robozonky with Apache License 2.0 | 4 votes |
@TestFactory Stream<DynamicNode> listeners() { // create events for listeners return Stream.of(SupportedListener.values()) .map(this::forListener); }
Example #28
Source File: TypeConversionIT.java From sdn-rx with Apache License 2.0 | 4 votes |
@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)); }); }
Example #29
Source File: NaturalLanguageStrategyServiceTest.java From robozonky with Apache License 2.0 | 4 votes |
@TestFactory Stream<DynamicNode> strategyType() { return Stream.of(Type.values()) .map(type -> dynamicContainer(type.toString(), forType(type))); }
Example #30
Source File: DefaultPortfolioTest.java From robozonky with Apache License 2.0 | 4 votes |
@TestFactory Stream<DynamicNode> ratings() { return Stream.of(Rating.values()) .map(r -> dynamicContainer(r.toString(), forRating(r))); }