本文整理汇总了Scala中org.junit.runner.RunWith类的典型用法代码示例。如果您正苦于以下问题:Scala RunWith类的具体用法?Scala RunWith怎么用?Scala RunWith使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RunWith类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Scala代码示例。
示例1: ConstructorsPopulationSpec
//设置package包名称以及导入依赖的类
package com.github.astonbitecode.di
import java.util.concurrent.TimeUnit
import scala.concurrent.Await
import scala.concurrent.duration.FiniteDuration
import org.junit.runner.RunWith
import org.specs2.mutable
import org.specs2.runner.JUnitRunner
import org.specs2.specification.BeforeEach
@RunWith(classOf[JUnitRunner])
class ConstructorsPopulationSpec extends mutable.Specification with BeforeEach {
val timeout = FiniteDuration(1000, TimeUnit.MILLISECONDS)
override def before() {
TestUtil.clean
}
sequential
"A spec for the Constructors population in the DI ".txt
"A constructor should be populated in the DI" >> {
val f = diDefine { () => MyInjectableClass("One") }
Await.result(f, timeout)
cache must haveSize(1)
}
"A constructor should be replaced in the DI if it already exists" >> {
val f1 = diDefine { () => MyInjectableClass("One") }
Await.result(f1, timeout)
val f2 = diDefine { () => MyInjectableClass("Two") }
Await.result(f2, timeout)
cache must haveSize(1)
cache.head._2.constructor.apply().asInstanceOf[MyInjectableClass].id === "Two"
}
"A constructor with scope SINGLETON_EAGER should create the instance upon the call" >> {
val f = diDefine(() => MyInjectableClass("One"), DIScope.SINGLETON_EAGER)
Await.result(f, timeout)
cache must haveSize(1)
cache.head._2.cachedInstance.isDefined === true
}
"A constructor with scope SINGLETON_LAZY should not create the instance upon the call" >> {
val f = diDefine(() => MyInjectableClass("One"), DIScope.SINGLETON_LAZY)
Await.result(f, timeout)
cache must haveSize(1)
cache.head._2.cachedInstance.isDefined === false
}
case class MyInjectableClass(id: String)
}
开发者ID:astonbitecode,项目名称:kind-of-di,代码行数:55,代码来源:ConstructorsPopulationSpec.scala
示例2: es
//设置package包名称以及导入依赖的类
package fr.sysf.sample
import java.time.LocalDate
import fr.sysf.sample.domain.Customer
import fr.sysf.sample.service.CustomerRepository
import org.assertj.core.api.Assertions
import org.assertj.core.api.Assertions.assertThat
import org.junit.Test
import org.junit.runner.RunWith
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner
@RunWith(classOf[SpringJUnit4ClassRunner])
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, classes = Array(classOf[ApplicationConfig]))
//@ContextConfiguration(classes = Array(classOf[ApplicationConfig]))
class CustomerDataTest {
@Autowired
private val customerRepository: CustomerRepository = null
@Test
def getHello {
val customer = new Customer()
customer.firstName = "Anna"
customer.lastName = "Blum"
customer.birthDate = LocalDate.of(1965, 2, 7)
var request = customerRepository.save(customer)
// getAll before insert
assertThat(request).isNotNull
assertThat(request.createdDate).isNotNull
assertThat(request.updatedDate).isEqualTo(request.createdDate)
Assertions.assertThat(request.version).isEqualTo(0l)
request.city = "Paris"
request = customerRepository.save(request)
assertThat(request).isNotNull
Assertions.assertThat(request.createdDate).isNotNull
Assertions.assertThat(request.city).isEqualTo("Paris")
Assertions.assertThat(request.version).isEqualTo(1l)
}
}
开发者ID:fpeyron,项目名称:sample-scala-mongo-rest,代码行数:52,代码来源:CustomerDataTest.scala
示例3: QuickCheckBinomialHeap
//设置package包名称以及导入依赖的类
package quickcheck
import org.scalatest.FunSuite
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import org.scalatest.prop.Checkers
import org.scalacheck.Arbitrary._
import org.scalacheck.Prop
import org.scalacheck.Prop._
import org.scalatest.exceptions.TestFailedException
object QuickCheckBinomialHeap extends QuickCheckHeap with BinomialHeap
@RunWith(classOf[JUnitRunner])
class QuickCheckSuite extends FunSuite with Checkers {
def checkBogus(p: Prop) {
var ok = false
try {
check(p)
} catch {
case e: TestFailedException =>
ok = true
}
assert(ok, "A bogus heap should NOT satisfy all properties. Try to find the bug!")
}
test("Binomial heap satisfies properties.") {
check(new QuickCheckHeap with quickcheck.test.BinomialHeap)
}
test("Bogus (1) binomial heap does not satisfy properties.") {
checkBogus(new QuickCheckHeap with quickcheck.test.Bogus1BinomialHeap)
}
test("Bogus (2) binomial heap does not satisfy properties.") {
checkBogus(new QuickCheckHeap with quickcheck.test.Bogus2BinomialHeap)
}
test("Bogus (3) binomial heap does not satisfy properties.") {
checkBogus(new QuickCheckHeap with quickcheck.test.Bogus3BinomialHeap)
}
test("Bogus (4) binomial heap does not satisfy properties.") {
checkBogus(new QuickCheckHeap with quickcheck.test.Bogus4BinomialHeap)
}
test("Bogus (5) binomial heap does not satisfy properties.") {
checkBogus(new QuickCheckHeap with quickcheck.test.Bogus5BinomialHeap)
}
}
开发者ID:vincenzobaz,项目名称:Functional-Programming-in-Scala,代码行数:53,代码来源:QuickCheckSuite.scala
示例4: CountChangeSuite
//设置package包名称以及导入依赖的类
package recfun
import org.scalatest.FunSuite
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
class CountChangeSuite extends FunSuite {
import Main.countChange
test("countChange: example given in instructions") {
assert(countChange(4,List(1,2)) === 3)
}
test("countChange: sorted CHF") {
assert(countChange(300,List(5,10,20,50,100,200,500)) === 1022)
}
test("countChange: no pennies") {
assert(countChange(301,List(5,10,20,50,100,200,500)) === 0)
}
test("countChange: unsorted CHF") {
assert(countChange(300,List(500,5,50,100,20,200,10)) === 1022)
}
}
开发者ID:vincenzobaz,项目名称:Functional-Programming-in-Scala,代码行数:27,代码来源:CountChangeSuite.scala
示例5: ContarCambiosPosiblesSuite
//设置package包名称以及导入依赖的类
import org.scalatest.FunSuite
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
class ContarCambiosPosiblesSuite extends FunSuite {
import Main.contarCambiosPosibles
// Prueba 1
test("contar cambios posibles: cambio de 4 con monedas de 1 y 2") {
assert(contarCambiosPosibles(4,List(1,2)) === 3)
}
// Prueba 2
test("contar cambios posibles: cambio de 300") {
assert(contarCambiosPosibles(300,List(5,10,20,50,100,200,500)) === 1022)
}
// Prueba 3
test("contar cambios posibles: cambio de 301") {
assert(contarCambiosPosibles(301,List(5,10,20,50,100,200,500)) === 0)
}
test("contar cambios posibles: cambio de 300 (cambiando de orden las monedas)") {
assert(contarCambiosPosibles(300,List(500,5,50,100,20,200,10)) === 1022)
}
}
开发者ID:romanarranz,项目名称:NTP,代码行数:28,代码来源:ContarCambiosPosiblesSuite.scala
示例6: NetSuite
//设置package包名称以及导入依赖的类
// Copyright (C) 2017 Calin Cruceru <[email protected]>.
//
// See the LICENCE file distributed with this work for additional
// information regarding copyright ownership.
package org.symnet.types.net
import org.junit.runner.RunWith
import org.scalatest.{FunSuite, Matchers}
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
class NetSuite extends FunSuite with Matchers {
test("ipv4 construction without a mask") {
val ip = Ipv4(10, 10, 0, 0)
ip.host shouldBe (10 << 24) + (10 << 16)
ip.mask shouldBe None
}
test("ipv4 construction with a mask") {
val ip = Ipv4(0, 0, 5, 199, Some(10))
ip.host shouldBe (5 << 8) + (199 << 0)
ip.mask shouldBe Some(10)
}
test("ipv4 toString") {
Ipv4(0, 0, 0, 1).toString shouldBe "0.0.0.1"
Ipv4(255, 255, 255, 0).toString shouldBe "255.255.255.0"
Ipv4(8, 8, 8, 8, Some(10)).toString shouldBe "8.8.8.8/10"
}
test("ipv4 inequality") {
Ipv4(10, 10, 10, 10, Some(10)) should not be (Ipv4(10, 10, 10, 0))
}
test("host range") {
val (lower, upper) = Ipv4(192, 168, 0, 0, Some(24)).toHostRange
lower shouldBe Ipv4(192, 168, 0, 0)
upper shouldBe Ipv4(192, 168, 0, 255)
}
test("host range - host part does not matter") {
val (lower, upper) = Ipv4(192, 168, 0, 12, Some(26)).toHostRange
lower shouldBe Ipv4(192, 168, 0, 0)
upper shouldBe Ipv4(192, 168, 0, 63)
}
}
开发者ID:calincru,项目名称:iptables-sefl,代码行数:50,代码来源:Net.scala
示例7: HuffmanSuite
//设置package包名称以及导入依赖的类
package patmat
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import org.scalatest.{FunSuite, ShouldMatchers}
import patmat.Huffman._
@RunWith(classOf[JUnitRunner])
class HuffmanSuite extends FunSuite with ShouldMatchers {
trait TestTrees {
val t1 = Fork(Leaf('a',2), Leaf('b',3), List('a','b'), 5)
val t2 = Fork(Fork(Leaf('a',2), Leaf('b',3), List('a','b'), 5), Leaf('d',4), List('a','b','d'), 9)
}
test("weight of a larger tree") {
new TestTrees {
weight(t1) should be(5)
}
}
test("chars of a larger tree") {
new TestTrees {
chars(t2) should be(List('a', 'b', 'd'))
}
}
test("string2chars(\"hello, world\")") {
string2Chars("hello, world") should be(List('h', 'e', 'l', 'l', 'o', ',', ' ', 'w', 'o', 'r', 'l', 'd'))
}
test("makeOrderedLeafList for some frequency table") {
makeOrderedLeafList(List(('t', 2), ('e', 1), ('x', 3))) should be(List(Leaf('e', 1), Leaf('t', 2), Leaf('x', 3)))
}
test("combine of some leaf list") {
val leaflist = List(Leaf('e', 1), Leaf('t', 2), Leaf('x', 4))
combine(leaflist) should be(List(Fork(Leaf('e', 1), Leaf('t', 2), List('e', 't'), 3), Leaf('x', 4)))
}
test("decode and encode a very short text should be identity") {
val fc = Huffman.frenchCode
decode(fc, encode(fc)("letsmakeitmorecomplicated".toList)) should be("letsmakeitmorecomplicated".toList)
}
}
开发者ID:letalvoj,项目名称:progfun_assignments,代码行数:52,代码来源:HuffmanSuite.scala
示例8: CountChangeSuite
//设置package包名称以及导入依赖的类
package recfun
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import org.scalatest.{FunSuite, ShouldMatchers}
@RunWith(classOf[JUnitRunner])
class CountChangeSuite extends FunSuite with ShouldMatchers {
import Week1.countChange
test("countChange: example given in instructions") {
countChange(4, List(1, 2)) should be(3)
}
test("countChange: sorted CHF") {
countChange(300, List(5, 10, 20, 50, 100, 200, 500)) should be(1022)
}
test("countChange: no pennies") {
countChange(301, List(5, 10, 20, 50, 100, 200, 500)) should be(0)
}
test("countChange: unsorted CHF") {
countChange(300, List(500, 5, 50, 100, 20, 200, 10)) should be(1022)
}
}
开发者ID:letalvoj,项目名称:progfun_assignments,代码行数:28,代码来源:CountChangeSuite.scala
示例9: MaximumPathSumSuite
//设置package包名称以及导入依赖的类
package lists
import org.scalatest.FunSuite
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
class MaximumPathSumSuite extends FunSuite {
import ProblemData._
import ProblemSolver._
test("one number problem") {
val paths = findOptimalPaths(List(List(42)))
val bestPath = chooseBestPath(paths)
assert(bestPath.isDefined)
assert(bestPath.get.sum === 42)
assert(bestPath.get === List(42))
}
test("sum of small problem") {
val paths = findOptimalPaths(small)
val bestPath = chooseBestPath(paths)
assert(bestPath.isDefined)
assert(bestPath.get.sum === 23)
}
test("path of small problem") {
val paths = findOptimalPaths(small)
val bestPath = chooseBestPath(paths)
assert(bestPath.isDefined)
assert(bestPath.get === List(3, 7, 4, 9))
}
test("sum of medium problem") {
val paths = findOptimalPaths(medium)
val bestPath = chooseBestPath(paths)
assert(bestPath.isDefined)
assert(bestPath.get.sum === 1074)
}
test("sum of large problem") {
val paths = findOptimalPaths(large)
val bestPath = chooseBestPath(paths)
assert(bestPath.isDefined)
assert(bestPath.get.sum === 7273)
}
}
开发者ID:mumukiller,项目名称:scala-course-one,代码行数:56,代码来源:ProblemSolverSuite.scala
示例10: PascalSuite
//设置package包名称以及导入依赖的类
package functions
import org.scalatest.FunSuite
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
class PascalSuite extends FunSuite {
import Main.pascal
test("pascal: col=0,row=2") {
assert(pascal(0,2) === 1)
}
test("pascal: col=1,row=2") {
assert(pascal(1,2) === 2)
}
test("pascal: col=1,row=3") {
assert(pascal(1,3) === 3)
}
}
开发者ID:mumukiller,项目名称:scala-course-one,代码行数:23,代码来源:PascalSuite.scala
示例11: BalanceSuite
//设置package包名称以及导入依赖的类
package functions
import org.scalatest.FunSuite
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
class BalanceSuite extends FunSuite {
import Main.balance
test("balance: '(if (zero? x) max (/ 1 x))' is balanced") {
assert(balance("(if (zero? x) max (/ 1 x))".toList))
}
test("balance: 'I told him ...' is balanced") {
assert(balance("I told him (that it's not (yet) done).\n(But he wasn't listening)".toList))
}
test("balance: ':-)' is unbalanced") {
assert(!balance(":-)".toList))
}
test("balance: counting is not enough") {
assert(!balance("())(".toList))
}
}
开发者ID:mumukiller,项目名称:scala-course-one,代码行数:28,代码来源:BalanceSuite.scala
示例12: CountChangeSuite
//设置package包名称以及导入依赖的类
package functions
import org.scalatest.FunSuite
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
class CountChangeSuite extends FunSuite {
import Main.countChange
test("countChange: example given in instructions") {
assert(countChange(4,List(1,2)) === 3)
}
test("countChange: sorted CHF") {
assert(countChange(300,List(5,10,20,50,100,200,500)) === 1022)
}
test("countChange: no pennies") {
assert(countChange(301,List(5,10,20,50,100,200,500)) === 0)
}
test("countChange: unsorted CHF") {
assert(countChange(300,List(500,5,50,100,20,200,10)) === 1022)
}
}
开发者ID:mumukiller,项目名称:scala-course-one,代码行数:27,代码来源:CountChangeSuite.scala
示例13: NotFoundPageTest
//设置package包名称以及导入依赖的类
package functional
import me.cs.easypost.Constants
import me.cs.easypost.models.RootModel
import org.junit.runner.RunWith
import org.specs2.runner.JUnitRunner
import play.api.test.{PlaySpecification, WithBrowser}
@RunWith(classOf[JUnitRunner])
class NotFoundPageTest extends PlaySpecification {
val rootModel = new RootModel
"Application" should {
"Display Action Not Found on a bad request" in new WithBrowser {
browser.goTo("/boum")
browser.$(rootModel.TitleId).getTexts().get(0) must equalTo(Constants.ActionNotFound)
}
}
}
开发者ID:ciscox83,项目名称:PostMeEasy,代码行数:21,代码来源:NotFoundPageTest.scala
示例14: IndexPageTest
//设置package包名称以及导入依赖的类
package me.cs.easypost
import me.cs.easypost.models.RootModel
import org.junit.runner.RunWith
import org.specs2.runner.JUnitRunner
import play.api.test.{PlaySpecification, WithBrowser}
@RunWith(classOf[JUnitRunner])
class IndexPageTest extends PlaySpecification {
val rootModel = new RootModel
"Application" should {
"display correctly the index page" in new WithBrowser {
browser.goTo("/")
browser.$(rootModel.TitleId).getTexts().get(0) must equalTo(rootModel.Title)
}
}
}
开发者ID:ciscox83,项目名称:PostMeEasy,代码行数:20,代码来源:IndexPageTest.scala
示例15: ExtractionTest
//设置package包名称以及导入依赖的类
package observatory
import org.junit.runner.RunWith
import org.scalatest.FunSuite
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
class ExtractionTest extends FunSuite {
test("locateTemperature should work with given year") {
val temp = Extraction.locateTemperatures(1986, "/stations.csv", "/1986.csv")
assert(temp.size == 2429828)
}
test("locationYearlyAverageRecords should work with given year") {
val temp = Extraction.locateTemperatures(1986, "/stations.csv", "/1986.csv")
val avg = Extraction.locationYearlyAverageRecords(temp)
assert(avg.size == 8755)
}
}
开发者ID:syhan,项目名称:coursera,代码行数:23,代码来源:ExtractionTest.scala
示例16: LineOfSightSuite
//设置package包名称以及导入依赖的类
package reductions
import java.util.concurrent._
import scala.collection._
import org.scalatest.FunSuite
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import common._
import java.util.concurrent.ForkJoinPool.ForkJoinWorkerThreadFactory
@RunWith(classOf[JUnitRunner])
class LineOfSightSuite extends FunSuite {
import LineOfSight._
test("lineOfSight should correctly handle an array of size 4") {
val output = new Array[Float](4)
lineOfSight(Array[Float](0f, 1f, 8f, 9f), output)
assert(output.toList == List(0f, 1f, 4f, 4f))
}
test("upsweepSequential should correctly handle the chunk 1 until 4 of an array of 4 elements") {
val res = upsweepSequential(Array[Float](0f, 1f, 8f, 9f), 1, 4)
assert(res == 4f)
}
test("downsweepSequential should correctly handle a 4 element array when the starting angle is zero") {
val output = new Array[Float](4)
downsweepSequential(Array[Float](0f, 1f, 8f, 9f), output, 0f, 1, 4)
assert(output.toList == List(0f, 1f, 4f, 4f))
}
}
开发者ID:syhan,项目名称:coursera,代码行数:36,代码来源:LineOfSightSuite.scala
示例17: ParallelParenthesesBalancingSuite
//设置package包名称以及导入依赖的类
package reductions
import java.util.concurrent._
import scala.collection._
import org.scalatest.FunSuite
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import common._
import ParallelParenthesesBalancing._
@RunWith(classOf[JUnitRunner])
class ParallelParenthesesBalancingSuite extends FunSuite {
test("balance should work for empty string") {
def check(input: String, expected: Boolean) =
assert(balance(input.toArray) == expected,
s"balance($input) should be $expected")
check("", true)
}
test("balance should work for string of length 1") {
def check(input: String, expected: Boolean) =
assert(balance(input.toArray) == expected,
s"balance($input) should be $expected")
check("(", false)
check(")", false)
check(".", true)
}
test("balance should work for string of length 2") {
def check(input: String, expected: Boolean) =
assert(balance(input.toArray) == expected,
s"balance($input) should be $expected")
check("()", true)
check(")(", false)
check("((", false)
check("))", false)
check(".)", false)
check(".(", false)
check("(.", false)
check(").", false)
}
test("parallel balance should work for string of any length") {
assert(!parBalance(")(".toArray, 1))
assert(parBalance("()".toArray, 1))
assert(parBalance("((()))".toArray, 1))
}
}
开发者ID:syhan,项目名称:coursera,代码行数:60,代码来源:ParallelParenthesesBalancingSuite.scala
示例18: CellSpec
//设置package包名称以及导入依赖的类
package de.htwg.se.SevenSteps.model.grid.basicImpl
import org.junit.runner.RunWith
import org.scalatest.Matchers._
import org.scalatest._
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
class CellSpec extends WordSpec {
"A Cell" should {
val cell = Cell('a', 2)
"have a color" in {
cell.color should be('a')
}
"have a height" in {
cell.height should be(2)
}
"generate a string in the form" in {
cell.toString should be("a 2")
}
"have a toXML function in the form" in {
cell.toXML().toString() should be("<cell colorCell=\"a\" height=\"2\"></cell>")
}
}
}
开发者ID:GrimmT,项目名称:de.htwg.se.SevenSteps,代码行数:27,代码来源:CellSpec.scala
示例19: GameMissileFireUpdaterTest
//设置package包名称以及导入依赖的类
package net.xylophones.planetoid.game.logic
import net.xylophones.planetoid.game.model.{GamePhysics, PlayerInput, GameEvent, GameModel}
import net.xylophones.planetoid.game.logic.ModelTestObjectMother._
import org.junit.runner.RunWith
import org.scalatest.{FunSuite, Matchers}
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
class GameMissileFireUpdaterTest extends FunSuite with Matchers {
val underTest = new GameMissileFireUpdater
test("missile gets launched when player is firing") {
// given
val model = GameModel(createDummyPlanet(), createDummyPlayers())
val player1Input = PlayerInput(left = false, right = false, thrust = false, fireMissile = true)
val player2Input = PlayerInput(left = false, right = false, thrust = false, fireMissile = false)
// when
val result = underTest.update(resultFromModel(model), new GamePhysics(), Vector(player1Input, player2Input))
// then
val newModel = result.model
val events = result.events
newModel.players.p1.missiles should have size 1
val missileRotation = newModel.players.p1.missiles(0).rotation
val missileRotationMatchesRocket = missileRotation ~= model.players.p1.rocket.rotation
missileRotationMatchesRocket shouldBe true
// and
events.contains(GameEvent.MissileFired) shouldBe true
}
}
开发者ID:wjsrobertson,项目名称:planetoid3d,代码行数:37,代码来源:GameMissileFireUpdaterTest.scala
示例20: RoundCompleteCountdownUpdaterTest
//设置package包名称以及导入依赖的类
package net.xylophones.planetoid.game.logic
import net.xylophones.planetoid.game.logic.ModelTestObjectMother._
import net.xylophones.planetoid.game.model.{GamePhysics, GameEvent, RoundCountdownTimer, GameModel}
import org.junit.runner.RunWith
import org.mockito.Mockito._
import org.scalatest.mock.MockitoSugar
import org.scalatest.{Matchers, FunSuite}
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
class RoundCompleteCountdownUpdaterTest extends FunSuite with Matchers with MockitoSugar {
val currentTimeSource = mock[CurrentTimeSource]
val underTest = new RoundCompleteCountdownUpdater(currentTimeSource)
test("counter gets decremented when exists") {
// given
val model = GameModel(createDummyPlanet(), createDummyPlayers(), roundEndTimer = Some(RoundCountdownTimer(0, 1000, 600)))
when(currentTimeSource.currentTime()).thenReturn(1599)
// when
val result = underTest.update(resultFromModel(model), new GamePhysics(), null)
// then
result.model.roundEndTimer.get.remainingTimeMs shouldBe 1
}
}
开发者ID:wjsrobertson,项目名称:planetoid3d,代码行数:32,代码来源:RoundCompleteCountdownUpdaterTest.scala
注:本文中的org.junit.runner.RunWith类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论