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 + } +}