I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 3d35984c authored by str4d's avatar str4d
Browse files

Started filling out UpdaterBehaviors

parent 6a91918e
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,11 @@ package net.i2p.router.update
import org.scalatest.FunSpec
import org.scalatest.mock.MockitoSugar
import java.util.TreeSet
import net.i2p.router.RouterContext
import net.i2p.update.UpdateMethod
import net.i2p.update.UpdateType
/**
* @author str4d
......@@ -16,9 +20,21 @@ class UnsignedUpdateHandlerSpec extends FunSpec with CheckerBehaviors with Updat
uuh
}
def validTypes = {
val vt = new TreeSet<UpdateType>
vt.add(UpdateType.ROUTER_UNSIGNED)
vt
}
def validMethods = {
val vm = new TreeSet<UpdateMethod>
vm.add(UpdateMethod.HTTP)
vm
}
describe("An UnsignedUpdateHandler") {
it should behave like checker(unsignedUpdateHandler)
it should behave like updater(unsignedUpdateHandler)
it should behave like updater(unsignedUpdateHandler, validTypes, validMethods)
}
}
......@@ -2,13 +2,24 @@ package net.i2p.router.update
import org.scalatest.FunSpec
import java.util.Collections
import java.util.Set
import net.i2p.update.UpdateMethod
import net.i2p.update.UpdateType
import net.i2p.update.Updater
/**
* @author str4d
*/
trait UpdaterBehaviors { this: FunSpec =>
def updater(newUpdater: => Updater) {
it("should provide a method to perform updates") (pending)
def updater(newUpdater: => Updater, validTypes: => Set<UpdateType>,
validMethods: => Set<UpdateMethod>) {
it("should return null if no updateSources are provided") {
val updateSources = Collections.emptyList
val updateTask = newUpdater.update(validTypes[0], validMethods[0],
updateSources, "", "", 1000)
updateTask should be (null)
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment