Changeset 3d35984


Ignore:
Timestamp:
Nov 5, 2012 10:37:18 AM (9 years ago)
Author:
str4d <str4d@…>
Branches:
master
Children:
3cb4d35
Parents:
6a91918
Message:

Started filling out UpdaterBehaviors?

Location:
apps/routerconsole/java/test/scalatest/net/i2p/router/update
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/java/test/scalatest/net/i2p/router/update/UnsignedUpdateHandlerSpec.scala

    r6a91918 r3d35984  
    44import org.scalatest.mock.MockitoSugar
    55
     6import java.util.TreeSet
     7
    68import net.i2p.router.RouterContext
     9import net.i2p.update.UpdateMethod
     10import net.i2p.update.UpdateType
    711
    812/**
     
    1721    }
    1822
     23    def validTypes = {
     24        val vt = new TreeSet<UpdateType>
     25        vt.add(UpdateType.ROUTER_UNSIGNED)
     26        vt
     27    }
     28
     29    def validMethods = {
     30        val vm = new TreeSet<UpdateMethod>
     31        vm.add(UpdateMethod.HTTP)
     32        vm
     33    }
     34
    1935    describe("An UnsignedUpdateHandler") {
    2036        it should behave like checker(unsignedUpdateHandler)
    2137
    22         it should behave like updater(unsignedUpdateHandler)
     38        it should behave like updater(unsignedUpdateHandler, validTypes, validMethods)
    2339    }
    2440}
  • apps/routerconsole/java/test/scalatest/net/i2p/router/update/UpdaterBehaviors.scala

    r6a91918 r3d35984  
    33import org.scalatest.FunSpec
    44
     5import java.util.Collections
     6import java.util.Set
     7
     8import net.i2p.update.UpdateMethod
     9import net.i2p.update.UpdateType
    510import net.i2p.update.Updater
    611
     
    914 */
    1015trait UpdaterBehaviors { this: FunSpec =>
    11     def updater(newUpdater: => Updater) {
    12         it("should provide a method to perform updates") (pending)
     16    def updater(newUpdater: => Updater, validTypes: => Set<UpdateType>,
     17                validMethods: => Set<UpdateMethod>) {
     18        it("should return null if no updateSources are provided") {
     19            val updateSources = Collections.emptyList
     20            val updateTask = newUpdater.update(validTypes[0], validMethods[0],
     21                                               updateSources, "", "", 1000)
     22            updateTask should be (null)
     23        }
    1324    }
    1425}
Note: See TracChangeset for help on using the changeset viewer.