From 38cc0a2459c03f4df2c33f9793fbf7ce708de506 Mon Sep 17 00:00:00 2001 From: Jesse Jaara Date: Thu, 15 Aug 2024 12:30:21 +0300 Subject: [PATCH] Fix some warning produced by the compiler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * assertThat(list).asList() → assertThat(list).asInstanceOf(InstanceOfAssertFactories.LIST) * Suppressed couple of unchecked cast warnings on the jOOQ converters * Fixed one uncheked cast to checked cast in a jOOQ converter --- .../jooq/converter/GeometryConverter.kt | 6 +- .../jooq/converter/LineStringConverter.kt | 1 + .../config/jooq/converter/PointConverter.kt | 1 + .../NodeSequenceCombinationsCreatorTest.kt | 29 ++-- .../service/node/VisitedNodesResolverTest.kt | 151 +++++++----------- 5 files changed, 82 insertions(+), 106 deletions(-) diff --git a/spring-boot/src/main/kotlin/fi/hsl/jore4/mapmatching/config/jooq/converter/GeometryConverter.kt b/spring-boot/src/main/kotlin/fi/hsl/jore4/mapmatching/config/jooq/converter/GeometryConverter.kt index b5539e44..4354b95b 100644 --- a/spring-boot/src/main/kotlin/fi/hsl/jore4/mapmatching/config/jooq/converter/GeometryConverter.kt +++ b/spring-boot/src/main/kotlin/fi/hsl/jore4/mapmatching/config/jooq/converter/GeometryConverter.kt @@ -8,7 +8,9 @@ import org.geolatte.geom.codec.Wkb import org.geolatte.geom.codec.Wkt import org.locationtech.jts.io.ParseException -class GeometryConverter(private val geometryType: GeometryType) { +class GeometryConverter( + private val geometryType: GeometryType +) { fun from(databaseObject: Any?): Geometry? = databaseObject?.let { try { @@ -25,6 +27,6 @@ class GeometryConverter(private val geometryType: GeometryType) { companion object { fun to(geom: Geometry?): String? = geom?.let { Wkt.toWkt(geom) } - internal fun read(hex: String): Geometry = Wkb.fromWkb(ByteBuffer.from(hex)) as Geometry + internal fun read(hex: String): Geometry = Wkb.fromWkb(ByteBuffer.from(hex)).`as`(C2D::class.java) } } diff --git a/spring-boot/src/main/kotlin/fi/hsl/jore4/mapmatching/config/jooq/converter/LineStringConverter.kt b/spring-boot/src/main/kotlin/fi/hsl/jore4/mapmatching/config/jooq/converter/LineStringConverter.kt index e678163f..f3f57dda 100644 --- a/spring-boot/src/main/kotlin/fi/hsl/jore4/mapmatching/config/jooq/converter/LineStringConverter.kt +++ b/spring-boot/src/main/kotlin/fi/hsl/jore4/mapmatching/config/jooq/converter/LineStringConverter.kt @@ -15,6 +15,7 @@ class LineStringConverter : Converter> { override fun fromType() = Any::class.java + @Suppress("UNCHECKED_CAST") override fun toType() = LineString::class.java as Class> companion object { diff --git a/spring-boot/src/main/kotlin/fi/hsl/jore4/mapmatching/config/jooq/converter/PointConverter.kt b/spring-boot/src/main/kotlin/fi/hsl/jore4/mapmatching/config/jooq/converter/PointConverter.kt index 0fbed3c8..18fdc539 100644 --- a/spring-boot/src/main/kotlin/fi/hsl/jore4/mapmatching/config/jooq/converter/PointConverter.kt +++ b/spring-boot/src/main/kotlin/fi/hsl/jore4/mapmatching/config/jooq/converter/PointConverter.kt @@ -15,6 +15,7 @@ class PointConverter : Converter> { override fun fromType() = Any::class.java + @Suppress("UNCHECKED_CAST") override fun toType() = Point::class.java as Class> companion object { diff --git a/spring-boot/src/test/kotlin/fi/hsl/jore4/mapmatching/service/node/NodeSequenceCombinationsCreatorTest.kt b/spring-boot/src/test/kotlin/fi/hsl/jore4/mapmatching/service/node/NodeSequenceCombinationsCreatorTest.kt index 7c2c4a11..c31eaa0d 100644 --- a/spring-boot/src/test/kotlin/fi/hsl/jore4/mapmatching/service/node/NodeSequenceCombinationsCreatorTest.kt +++ b/spring-boot/src/test/kotlin/fi/hsl/jore4/mapmatching/service/node/NodeSequenceCombinationsCreatorTest.kt @@ -9,6 +9,7 @@ import fi.hsl.jore4.mapmatching.test.generators.InfrastructureNodeIdGenerator.in import fi.hsl.jore4.mapmatching.test.generators.Retry import fi.hsl.jore4.mapmatching.util.CollectionUtils.filterOutConsecutiveDuplicates import org.assertj.core.api.Assertions.assertThat +import org.assertj.core.api.InstanceOfAssertFactories import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Nested import org.junit.jupiter.api.Test @@ -33,7 +34,7 @@ class NodeSequenceCombinationsCreatorTest { val nodesToVisit = VisitSingleNode(nodeId) assertThat(NodeSequenceCombinationsCreator.create(nodesToVisit)) - .asList() + .asInstanceOf(InstanceOfAssertFactories.LIST) .hasSize(1) } } @@ -47,7 +48,7 @@ class NodeSequenceCombinationsCreatorTest { val nodesToVisit = VisitSingleNode(nodeId) assertThat(NodeSequenceCombinationsCreator.create(nodesToVisit)) - .asList() + .asInstanceOf(InstanceOfAssertFactories.LIST) .isEqualTo( listOf( NodeIdSequence( @@ -73,7 +74,7 @@ class NodeSequenceCombinationsCreatorTest { val nodesToVisit = VisitNodesOfSingleLinkUnidirectionally(startNodeId, endNodeId) assertThat(NodeSequenceCombinationsCreator.create(nodesToVisit)) - .asList() + .asInstanceOf(InstanceOfAssertFactories.LIST) .hasSize(1) } } @@ -87,7 +88,7 @@ class NodeSequenceCombinationsCreatorTest { val nodesToVisit = VisitNodesOfSingleLinkUnidirectionally(startNodeId, endNodeId) assertThat(NodeSequenceCombinationsCreator.create(nodesToVisit)) - .asList() + .asInstanceOf(InstanceOfAssertFactories.LIST) .isEqualTo( listOf( NodeIdSequence( @@ -114,7 +115,7 @@ class NodeSequenceCombinationsCreatorTest { val nodesToVisit = VisitNodesOfSingleLinkBidirectionally(firstNodeId, secondNodeId) assertThat(NodeSequenceCombinationsCreator.create(nodesToVisit)) - .asList() + .asInstanceOf(InstanceOfAssertFactories.LIST) .hasSize(2) } } @@ -128,7 +129,7 @@ class NodeSequenceCombinationsCreatorTest { val nodesToVisit = VisitNodesOfSingleLinkBidirectionally(firstNodeId, secondNodeId) assertThat(NodeSequenceCombinationsCreator.create(nodesToVisit)) - .asList() + .asInstanceOf(InstanceOfAssertFactories.LIST) .isEqualTo( listOf( NodeIdSequence( @@ -173,7 +174,7 @@ class NodeSequenceCombinationsCreatorTest { ) assertThat(NodeSequenceCombinationsCreator.create(nodesToVisit)) - .asList() + .asInstanceOf(InstanceOfAssertFactories.LIST) .hasSizeGreaterThanOrEqualTo(1) .hasSizeLessThanOrEqualTo(4) } @@ -309,7 +310,7 @@ class NodeSequenceCombinationsCreatorTest { ) assertThat(NodeSequenceCombinationsCreator.create(nodesToVisit)) - .asList() + .asInstanceOf(InstanceOfAssertFactories.LIST) .hasSizeLessThanOrEqualTo(2) } } @@ -355,7 +356,7 @@ class NodeSequenceCombinationsCreatorTest { ) assertThat(NodeSequenceCombinationsCreator.create(nodesToVisit)) - .asList() + .asInstanceOf(InstanceOfAssertFactories.LIST) .hasSizeLessThanOrEqualTo(2) } } @@ -401,7 +402,7 @@ class NodeSequenceCombinationsCreatorTest { ) assertThat(NodeSequenceCombinationsCreator.create(nodesToVisit)) - .asList() + .asInstanceOf(InstanceOfAssertFactories.LIST) .hasSizeLessThanOrEqualTo(2) } } @@ -467,7 +468,7 @@ class NodeSequenceCombinationsCreatorTest { ) assertThat(NodeSequenceCombinationsCreator.create(nodesToVisit)) - .asList() + .asInstanceOf(InstanceOfAssertFactories.LIST) .hasSizeLessThanOrEqualTo(2) } } @@ -533,7 +534,7 @@ class NodeSequenceCombinationsCreatorTest { ) assertThat(NodeSequenceCombinationsCreator.create(nodesToVisit)) - .asList() + .asInstanceOf(InstanceOfAssertFactories.LIST) .hasSizeGreaterThanOrEqualTo(2) } } @@ -603,7 +604,7 @@ class NodeSequenceCombinationsCreatorTest { ) assertThat(NodeSequenceCombinationsCreator.create(nodesToVisit)) - .asList() + .asInstanceOf(InstanceOfAssertFactories.LIST) .hasSizeGreaterThanOrEqualTo(2) } } @@ -673,7 +674,7 @@ class NodeSequenceCombinationsCreatorTest { ) assertThat(NodeSequenceCombinationsCreator.create(nodesToVisit)) - .asList() + .asInstanceOf(InstanceOfAssertFactories.LIST) .hasSize(4) } } diff --git a/spring-boot/src/test/kotlin/fi/hsl/jore4/mapmatching/service/node/VisitedNodesResolverTest.kt b/spring-boot/src/test/kotlin/fi/hsl/jore4/mapmatching/service/node/VisitedNodesResolverTest.kt index 87dbf8f3..8e4ac0b5 100644 --- a/spring-boot/src/test/kotlin/fi/hsl/jore4/mapmatching/service/node/VisitedNodesResolverTest.kt +++ b/spring-boot/src/test/kotlin/fi/hsl/jore4/mapmatching/service/node/VisitedNodesResolverTest.kt @@ -27,6 +27,7 @@ import fi.hsl.jore4.mapmatching.service.node.VisitedNodesResolverParamsGenerator import fi.hsl.jore4.mapmatching.service.node.VisitedNodesResolverParamsGenerator.ViaNodeGenerationScheme.VIA_NODES_NON_REDUNDANT import fi.hsl.jore4.mapmatching.service.node.VisitedNodesResolverParamsGenerator.ViaNodeGenerationScheme.VIA_NODES_NOT_STARTING_OR_ENDING_WITH_NODES_OF_TERMINUS_LINKS import org.assertj.core.api.Assertions.assertThat +import org.assertj.core.api.InstanceOfAssertFactories import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Nested import org.junit.jupiter.api.Test @@ -43,14 +44,13 @@ class VisitedNodesResolverTest { @Nested @DisplayName("When endpoints of single link are non-discrete (link starts from and ends at same node)") inner class WhenEndpointsOfLinkAreNonDiscrete { - fun forInputs(viaNodeGenerationScheme: ViaNodeGenerationScheme): TheoryBuilder { - return forAll( + fun forInputs(viaNodeGenerationScheme: ViaNodeGenerationScheme): TheoryBuilder = + forAll( withSingleLink( TerminusLinkProperties.from(NON_DISCRETE_NODES), viaNodeGenerationScheme ) ) - } @Test fun whenNoViaNodesAreGiven() { @@ -94,12 +94,11 @@ class VisitedNodesResolverTest { linkDirection: LinkDirection, snapPointLocation: SnapPointLocation, viaNodeScheme: ViaNodeGenerationScheme - ): Gen { - return withSingleLink( + ): Gen = + withSingleLink( TerminusLinkProperties(DISCRETE_NODES, linkDirection, snapPointLocation), viaNodeScheme ) - } @Nested @DisplayName("When single link is bidirectional") @@ -107,9 +106,8 @@ class VisitedNodesResolverTest { fun forInputs( snapPointLocation: SnapPointLocation, viaNodeScheme: ViaNodeGenerationScheme - ): TheoryBuilder { - return forAll(withSingleLink(BIDIRECTIONAL, snapPointLocation, viaNodeScheme)) - } + ): TheoryBuilder = + forAll(withSingleLink(BIDIRECTIONAL, snapPointLocation, viaNodeScheme)) @Nested @DisplayName("When first snap point is closer to link start") @@ -257,18 +255,16 @@ class VisitedNodesResolverTest { fun withSingleLink( snapPointLocation: SnapPointLocation, viaNodeScheme: ViaNodeGenerationScheme - ): Gen { - return withSingleLink(ONE_WAY_AGAINST_DIGITISED_DIRECTION, snapPointLocation, viaNodeScheme) - } + ): Gen = + withSingleLink(ONE_WAY_AGAINST_DIGITISED_DIRECTION, snapPointLocation, viaNodeScheme) - fun forInputs(viaNodeScheme: ViaNodeGenerationScheme): TheoryBuilder { - return forAll( + fun forInputs(viaNodeScheme: ViaNodeGenerationScheme): TheoryBuilder = + forAll( oneOf( withSingleLink(AT_OR_CLOSE_TO_END, viaNodeScheme), withSingleLink(AT_MIDPOINT, viaNodeScheme) ) ) - } @Test fun whenNoViaNodesAreGiven() { @@ -310,15 +306,14 @@ class VisitedNodesResolverTest { @Nested @DisplayName("When first snap point is closer to link start") inner class WhenFirstSnapPointIsCloserToLinkStart { - fun forInputs(viaNodeScheme: ViaNodeGenerationScheme): TheoryBuilder { - return forAll( + fun forInputs(viaNodeScheme: ViaNodeGenerationScheme): TheoryBuilder = + forAll( withSingleLink( ONE_WAY_AGAINST_DIGITISED_DIRECTION, AT_OR_CLOSE_TO_START, viaNodeScheme ) ) - } @Nested @DisplayName("When no via nodes are given") @@ -332,7 +327,7 @@ class VisitedNodesResolverTest { assertThat(createOutput(input)) .isInstanceOfSatisfying(VisitNodesOnMultipleLinks::class.java) { assertThat(it.viaNodeIds) - .asList() + .asInstanceOf(InstanceOfAssertFactories.LIST) .isEmpty() } } @@ -370,7 +365,7 @@ class VisitedNodesResolverTest { assertThat(createOutput(input)) .isInstanceOfSatisfying(VisitNodesOnMultipleLinks::class.java) { assertThat(it.viaNodeIds) - .asList() + .asInstanceOf(InstanceOfAssertFactories.LIST) .isEmpty() } } @@ -406,7 +401,7 @@ class VisitedNodesResolverTest { assertThat(createOutput(input)) .isInstanceOfSatisfying(VisitNodesOnMultipleLinks::class.java) { assertThat(it.viaNodeIds) - .asList() + .asInstanceOf(InstanceOfAssertFactories.LIST) .isNotEmpty() } } @@ -424,18 +419,16 @@ class VisitedNodesResolverTest { fun withSingleLink( snapPointLocation: SnapPointLocation, viaNodeScheme: ViaNodeGenerationScheme - ): Gen { - return withSingleLink(ONE_WAY_ALONG_DIGITISED_DIRECTION, snapPointLocation, viaNodeScheme) - } + ): Gen = + withSingleLink(ONE_WAY_ALONG_DIGITISED_DIRECTION, snapPointLocation, viaNodeScheme) - fun forInputs(viaNodeScheme: ViaNodeGenerationScheme): TheoryBuilder { - return forAll( + fun forInputs(viaNodeScheme: ViaNodeGenerationScheme): TheoryBuilder = + forAll( oneOf( withSingleLink(AT_OR_CLOSE_TO_START, viaNodeScheme), withSingleLink(AT_MIDPOINT, viaNodeScheme) ) ) - } @Test fun whenNoViaNodesAreGiven() { @@ -477,15 +470,14 @@ class VisitedNodesResolverTest { @Nested @DisplayName("When first snap point is closer to link end") inner class WhenFirstSnapPointIsCloserToLinkEnd { - fun forInputs(viaNodeScheme: ViaNodeGenerationScheme): TheoryBuilder { - return forAll( + fun forInputs(viaNodeScheme: ViaNodeGenerationScheme): TheoryBuilder = + forAll( withSingleLink( ONE_WAY_ALONG_DIGITISED_DIRECTION, AT_OR_CLOSE_TO_END, viaNodeScheme ) ) - } @Nested @DisplayName("When no via nodes are given") @@ -499,7 +491,7 @@ class VisitedNodesResolverTest { assertThat(createOutput(input)) .isInstanceOfSatisfying(VisitNodesOnMultipleLinks::class.java) { assertThat(it.viaNodeIds) - .asList() + .asInstanceOf(InstanceOfAssertFactories.LIST) .isEmpty() } } @@ -537,7 +529,7 @@ class VisitedNodesResolverTest { assertThat(createOutput(input)) .isInstanceOfSatisfying(VisitNodesOnMultipleLinks::class.java) { assertThat(it.viaNodeIds) - .asList() + .asInstanceOf(InstanceOfAssertFactories.LIST) .isEmpty() } } @@ -573,7 +565,7 @@ class VisitedNodesResolverTest { assertThat(createOutput(input)) .isInstanceOfSatisfying(VisitNodesOnMultipleLinks::class.java) { assertThat(it.viaNodeIds) - .asList() + .asInstanceOf(InstanceOfAssertFactories.LIST) .isNotEmpty() } } @@ -594,12 +586,11 @@ class VisitedNodesResolverTest { DISCRETE_LINKS, ViaNodeGenerationScheme.ANY ) - ) - .checkAssert { input: VisitedNodesResolverParams -> + ).checkAssert { input: VisitedNodesResolverParams -> - assertThat(createOutput(input)) - .isExactlyInstanceOf(VisitNodesOnMultipleLinks::class.java) - } + assertThat(createOutput(input)) + .isExactlyInstanceOf(VisitNodesOnMultipleLinks::class.java) + } } @Nested @@ -621,7 +612,7 @@ class VisitedNodesResolverTest { assertThat(createOutput(input)) .isInstanceOfSatisfying(VisitNodesOnMultipleLinks::class.java) { assertThat(it.viaNodeIds) - .asList() + .asInstanceOf(InstanceOfAssertFactories.LIST) .isEmpty() } } @@ -635,7 +626,7 @@ class VisitedNodesResolverTest { assertThat(createOutput(input)) .isInstanceOfSatisfying(VisitNodesOnMultipleLinks::class.java) { assertThat(it.viaNodeIds) - .asList() + .asInstanceOf(InstanceOfAssertFactories.LIST) .isNotEmpty() } } @@ -649,7 +640,7 @@ class VisitedNodesResolverTest { assertThat(createOutput(input)) .isInstanceOfSatisfying(VisitNodesOnMultipleLinks::class.java) { assertThat(it.viaNodeIds) - .asList() + .asInstanceOf(InstanceOfAssertFactories.LIST) .isNotEmpty() } } @@ -715,8 +706,7 @@ class VisitedNodesResolverTest { TerminusLinkProperties.NON_DISCRETE_NODES, ViaNodeGenerationScheme.ANY ) - ) - .checkAssert { expectVisitSingleNode(it) } + ).checkAssert { expectVisitSingleNode(it) } } @Nested @@ -734,8 +724,7 @@ class VisitedNodesResolverTest { ), ViaNodeGenerationScheme.ANY ) - ) - .checkAssert { expectVisitSingleNode(it) } + ).checkAssert { expectVisitSingleNode(it) } } @Test @@ -750,8 +739,7 @@ class VisitedNodesResolverTest { ), ViaNodeGenerationScheme.ANY ) - ) - .checkAssert { expectVisitSingleNode(it) } + ).checkAssert { expectVisitSingleNode(it) } } @Nested @@ -766,13 +754,11 @@ class VisitedNodesResolverTest { DISCRETE_LINKS_UNCONNECTED, TerminusLinkProperties(DISCRETE_NODES, linkDirection, snapPointLocation), VIA_NODES_NOT_STARTING_OR_ENDING_WITH_NODES_OF_TERMINUS_LINKS - ) - .map { params -> - params.run { - withViaNodeIds(listOf(pointOnStartLink.furtherNodeId) + viaNodeIds) - } + ).map { params -> + params.run { + withViaNodeIds(listOf(pointOnStartLink.furtherNodeId) + viaNodeIds) } - .describedAs { prettyPrint(it) } + }.describedAs { prettyPrint(it) } return forAll(genParams) } @@ -782,8 +768,7 @@ class VisitedNodesResolverTest { forInputs( BIDIRECTIONAL, BETWEEN_ENDPOINTS_EXCLUSIVE - ) - .checkAssert { expectVisitSingleNode(it) } + ).checkAssert { expectVisitSingleNode(it) } } @Nested @@ -846,8 +831,8 @@ class VisitedNodesResolverTest { @Nested @DisplayName("When further node from snapped start link location DOES NOT appear at start of via nodes") inner class WhenFurtherNodeFromSnappedStartLinkLocationDoesNotAppearAtStartOfViaNodes { - fun forInputs(linkDirection: LinkDirection): TheoryBuilder { - return forAll( + fun forInputs(linkDirection: LinkDirection): TheoryBuilder = + forAll( withStartLink( DISCRETE_LINKS, TerminusLinkProperties( @@ -858,7 +843,6 @@ class VisitedNodesResolverTest { VIA_NODES_NOT_STARTING_OR_ENDING_WITH_NODES_OF_TERMINUS_LINKS ) ) - } @Test fun whenStartLinkIsBidirectional() { @@ -940,8 +924,7 @@ class VisitedNodesResolverTest { TerminusLinkProperties.NON_DISCRETE_NODES, ViaNodeGenerationScheme.ANY ) - ) - .checkAssert { expectVisitSingleNode(it) } + ).checkAssert { expectVisitSingleNode(it) } } @Nested @@ -959,8 +942,7 @@ class VisitedNodesResolverTest { ), ViaNodeGenerationScheme.ANY ) - ) - .checkAssert { expectVisitSingleNode(it) } + ).checkAssert { expectVisitSingleNode(it) } } @Test @@ -975,8 +957,7 @@ class VisitedNodesResolverTest { ), ViaNodeGenerationScheme.ANY ) - ) - .checkAssert { expectVisitSingleNode(it) } + ).checkAssert { expectVisitSingleNode(it) } } @Nested @@ -991,13 +972,11 @@ class VisitedNodesResolverTest { DISCRETE_LINKS_UNCONNECTED, TerminusLinkProperties(DISCRETE_NODES, linkDirection, snapPointLocation), VIA_NODES_NOT_STARTING_OR_ENDING_WITH_NODES_OF_TERMINUS_LINKS - ) - .map { params -> - params.run { - withViaNodeIds(viaNodeIds + pointOnEndLink.furtherNodeId) - } + ).map { params -> + params.run { + withViaNodeIds(viaNodeIds + pointOnEndLink.furtherNodeId) } - .describedAs { prettyPrint(it) } + }.describedAs { prettyPrint(it) } return forAll(genParams) } @@ -1007,8 +986,7 @@ class VisitedNodesResolverTest { forInputs( BIDIRECTIONAL, BETWEEN_ENDPOINTS_EXCLUSIVE - ) - .checkAssert { expectVisitSingleNode(it) } + ).checkAssert { expectVisitSingleNode(it) } } @Nested @@ -1071,8 +1049,8 @@ class VisitedNodesResolverTest { @Nested @DisplayName("When further node from snapped end link location DOES NOT appear at end of via nodes") inner class WhenFurtherNodeFromSnappedEndLinkLocationDoesNotAppearAtEndOfViaNodes { - fun forInputs(linkDirection: LinkDirection): TheoryBuilder { - return forAll( + fun forInputs(linkDirection: LinkDirection): TheoryBuilder = + forAll( withEndLink( DISCRETE_LINKS, TerminusLinkProperties( @@ -1083,7 +1061,6 @@ class VisitedNodesResolverTest { VIA_NODES_NOT_STARTING_OR_ENDING_WITH_NODES_OF_TERMINUS_LINKS ) ) - } @Test fun whenEndLinkIsBidirectional() { @@ -1111,19 +1088,18 @@ class VisitedNodesResolverTest { private fun forAll( inputGen: Gen, randomnessSeed: Long = System.nanoTime() - ): TheoryBuilder { - return qt() + ): TheoryBuilder = + qt() .withFixedSeed(randomnessSeed) .forAll(inputGen) - } private fun createInput( terminusLinkRelation: TerminusLinkRelation, startLinkProperties: TerminusLinkProperties, endLinkProperties: TerminusLinkProperties, viaNodeGenerationScheme: ViaNodeGenerationScheme - ): Gen { - return VisitedNodesResolverParamsGenerator + ): Gen = + VisitedNodesResolverParamsGenerator .builder() .withTerminusLinkRelation(terminusLinkRelation) .withStartLinkProperties(startLinkProperties) @@ -1131,26 +1107,22 @@ class VisitedNodesResolverTest { .withViaNodeGenerationScheme(viaNodeGenerationScheme) .build() .describedAs(this::prettyPrint) - } private fun createInput( terminusLinkRelation: TerminusLinkRelation, viaNodeGenerationScheme: ViaNodeGenerationScheme - ): Gen { - return createInput( + ): Gen = + createInput( terminusLinkRelation, TerminusLinkProperties.ANY_VALUES, TerminusLinkProperties.ANY_VALUES, viaNodeGenerationScheme ) - } private fun withSingleLink( linkProperties: TerminusLinkProperties, viaNodeGenerationScheme: ViaNodeGenerationScheme - ): Gen { - return withTerminusLink(SAME_LINK, linkProperties, viaNodeGenerationScheme, true) - } + ): Gen = withTerminusLink(SAME_LINK, linkProperties, viaNodeGenerationScheme, true) private fun withStartLink( terminusLinkRelation: TerminusLinkRelation, @@ -1212,12 +1184,11 @@ class VisitedNodesResolverTest { """.trimIndent() } - private fun createOutput(params: VisitedNodesResolverParams): VisitedNodes { - return VisitedNodesResolver.resolve( + private fun createOutput(params: VisitedNodesResolverParams): VisitedNodes = + VisitedNodesResolver.resolve( params.pointOnStartLink, params.viaNodeIds, params.pointOnEndLink ) - } } }