From dc7e6f88e16d65bed3316894423c8d26659d4919 Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Mon, 3 Jul 2023 15:56:40 +0200 Subject: [PATCH] Atomize PathsTest --- .../kotlin/org/pgpainless/wot/dijkstra/PathsTest.kt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/wot-dijkstra/src/test/kotlin/org/pgpainless/wot/dijkstra/PathsTest.kt b/wot-dijkstra/src/test/kotlin/org/pgpainless/wot/dijkstra/PathsTest.kt index 187e558f..6174263a 100644 --- a/wot-dijkstra/src/test/kotlin/org/pgpainless/wot/dijkstra/PathsTest.kt +++ b/wot-dijkstra/src/test/kotlin/org/pgpainless/wot/dijkstra/PathsTest.kt @@ -23,13 +23,13 @@ class PathsTest { private val alice_bob_2 = Certification(alice, bob, 160, Depth.limited(1)) @Test - fun emptyPathsTest() { + fun `verify that an empty Paths object has an amount of zero`() { val empty = Paths() assertEquals(0, empty.amount) } @Test - fun singlePathTest() { + fun `verify that the amount of a Paths containing a single Path equals the Path's amount`() { val path = Path(alice).apply { append(alice_bob_1) } val single = Paths().apply { add(path, 140) } @@ -37,7 +37,7 @@ class PathsTest { } @Test - fun twoPathsTest() { + fun `verify that the amounts of two Path objects sum up`() { val path1 = Path(alice).apply { append(alice_bob_1) } val path2 = Path(alice).apply { append(alice_bob_2) } val twoPaths = Paths().apply { @@ -49,7 +49,7 @@ class PathsTest { } @Test - fun notEnoughAmountTest() { + fun `verify that a Path cannot be added if its amount is less than the method argument armound`() { val path = Path(alice).apply { append(alice_bob_1) } val paths = Paths() assertThrows { @@ -57,6 +57,9 @@ class PathsTest { } } - fun Certification(issuer: CertSynopsis, target: CertSynopsis, amount: Int, depth: Depth): Certification = + /** + * Factory method to create a [Certification] more easily for test purposes. + */ + private fun Certification(issuer: CertSynopsis, target: CertSynopsis, amount: Int, depth: Depth): Certification = Certification(issuer, target, null, Date(), null, true, amount, depth, RegexSet.wildcard()) } \ No newline at end of file