From 1a5d131b9cbdd991fc3009d62ce509d905fef45e Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Fri, 30 Jun 2023 18:06:45 +0200 Subject: [PATCH] Test Certification class --- .../wot/dijkstra/CertificationTest.kt | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 wot-dijkstra/src/test/kotlin/org/pgpainless/wot/dijkstra/CertificationTest.kt diff --git a/wot-dijkstra/src/test/kotlin/org/pgpainless/wot/dijkstra/CertificationTest.kt b/wot-dijkstra/src/test/kotlin/org/pgpainless/wot/dijkstra/CertificationTest.kt new file mode 100644 index 00000000..1c13a137 --- /dev/null +++ b/wot-dijkstra/src/test/kotlin/org/pgpainless/wot/dijkstra/CertificationTest.kt @@ -0,0 +1,33 @@ +package org.pgpainless.wot.dijkstra + +import org.junit.jupiter.api.Test +import org.pgpainless.wot.dijkstra.sq.CertSynopsis +import org.pgpainless.wot.dijkstra.sq.Certification +import org.pgpainless.wot.dijkstra.sq.Fingerprint +import org.pgpainless.wot.dijkstra.sq.RevocationState +import java.util.* +import kotlin.test.assertEquals + +class CertificationTest { + + private val alice = CertSynopsis( + Fingerprint("0000000000000000000000000000000000000000"), + null, + RevocationState.notRevoked(), + mapOf(Pair("Alice ", RevocationState.notRevoked()))) + private val bob = CertSynopsis( + Fingerprint("1111111111111111111111111111111111111111"), + null, + RevocationState.notRevoked(), + mapOf(Pair("Bob ", RevocationState.notRevoked()))) + + @Test + fun testToString() { + val certification = Certification(alice, "Bob ", bob, Date()) + assertEquals("0000000000000000000000000000000000000000 (Alice ) certifies [Bob ] 1111111111111111111111111111111111111111", + certification.toString()) + val delegation = Certification(alice, null, bob, Date()) + assertEquals("0000000000000000000000000000000000000000 (Alice ) delegates to 1111111111111111111111111111111111111111", + delegation.toString()) + } +} \ No newline at end of file