From b4c42a05a22ea82f4d80bddfb963f9a3b8220f4f Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Wed, 11 Jul 2018 13:19:14 +0100 Subject: [PATCH] Crawler test --- .../com/muwire/hostcache/CrawlerTest.groovy | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 host-cache/src/test/groovy/com/muwire/hostcache/CrawlerTest.groovy diff --git a/host-cache/src/test/groovy/com/muwire/hostcache/CrawlerTest.groovy b/host-cache/src/test/groovy/com/muwire/hostcache/CrawlerTest.groovy new file mode 100644 index 00000000..7298db32 --- /dev/null +++ b/host-cache/src/test/groovy/com/muwire/hostcache/CrawlerTest.groovy @@ -0,0 +1,37 @@ +package com.muwire.hostcache + +import org.junit.Before +import org.junit.Test + +import groovy.mock.interceptor.MockFor +import groovy.mock.interceptor.StubFor +import net.i2p.data.Destination + +class CrawlerTest { + + def pingerMock + def pinger + + def hostPoolMock + def hostPool + + def crawler + + @Before + void before() { + pingerMock = new MockFor(Pinger) + pinger = pingerMock.proxyInstance() + + hostPoolMock = new MockFor(HostPool) + hostPool = hostPoolMock.proxyInstance() + + crawler = new Crawler(pinger, hostPool) + } + + @Test + void testBadJson() { + def unpingedHost = new Host(destination : new Destination()) + crawler.handleCrawlerPong(null, new Destination()) + hostPoolMock.verify hostPool + } +}