From 8f6b6b0caa2c945c9cd181a0372e3efd4bdf50ab Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Sun, 10 Nov 2019 05:20:09 +0000 Subject: [PATCH] update test for new json format --- .../groovy/com/muwire/core/trust/TrustServiceTest.groovy | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/test/groovy/com/muwire/core/trust/TrustServiceTest.groovy b/core/src/test/groovy/com/muwire/core/trust/TrustServiceTest.groovy index 49130c96..c834f6b3 100644 --- a/core/src/test/groovy/com/muwire/core/trust/TrustServiceTest.groovy +++ b/core/src/test/groovy/com/muwire/core/trust/TrustServiceTest.groovy @@ -8,6 +8,7 @@ import com.muwire.core.Destinations import com.muwire.core.Persona import com.muwire.core.Personas +import groovy.json.JsonSlurper import net.i2p.data.Base64 import net.i2p.data.Destination @@ -55,13 +56,16 @@ class TrustServiceTest { service.onTrustEvent new TrustEvent(level: TrustLevel.DISTRUSTED, persona: personas.persona2) Thread.sleep(250) + JsonSlurper slurper = new JsonSlurper() def trusted = new HashSet<>() persistGood.eachLine { - trusted.add(new Persona(new ByteArrayInputStream(Base64.decode(it)))) + def json = slurper.parseText(it) + trusted.add(new Persona(new ByteArrayInputStream(Base64.decode(json.persona)))) } def distrusted = new HashSet<>() persistBad.eachLine { - distrusted.add(new Persona(new ByteArrayInputStream(Base64.decode(it)))) + def json = slurper.parseText(it) + distrusted.add(new Persona(new ByteArrayInputStream(Base64.decode(json.persona)))) } assert trusted.size() == 1