sudo update-alternatives --config javacbut I changed also java version
sudo update-alternatives --config javaHope it saves you few minutes. Leave me a comment if it helps
sudo update-alternatives --config javacbut I changed also java version
sudo update-alternatives --config javaHope it saves you few minutes. Leave me a comment if it helps
trait FooCtrl extends Controller { def fooRepo: FooRepo def foo() = Action { fooRepo.findAll() Ok } } object FooCtrl extends FooCtrl { override def fooRepo = FooMongoRepo }where FooMongoRepo is implementation of FooRepo based on play reactivemongo plugin.
class FooCtrlIT extends Specification with Mockito { class FooCtrlTest extends FooCtrl { val fooRepo = mock[FooRepo] //if you wonder //why it is val, hmmm ... mock //verifying doesn't work for me on override def } "Foo controler" should { "return ok" in { val fooTest = new FooCtrlTest val request = FakeRequest("GET", "/api/foos") val result = fooTest.foo()(request) status(result) must equalTo(OK) } } }
running(FakeApplication())
[error] r.c.a.MongoDBSystem - (State: Closing) UNHANDLED MESSAGE: ChannelConnected(-951772015 [info] application - ReactiveMongo Connections stopped. [Success(Closed)] [INFO] [07/31/2014 21:12:39.933] [application-akka.actor.default-dispatcher-2] [akka://application/user/$b] Message [reactivemongo.core.actors.Close$] from Actor[akka://application/deadLetters] to Actor[akka://application/user/$b#162091841] was not delivered. [1] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
running(FakeApplication(withoutPlugins = Seq("play.modules.reactivemongo.ReactiveMongoPlugin"))) { ... }
context.parrent ! FOOMsg("foo")One of possible and reusable solution is to create:
import akka.testkit.{TestProbe, TestKit} import org.scalatest.Suite import akka.actor.{Actor, Props, ActorSystem} trait TestParentChildRelation { this: TestKit with Suite => def mockParentWithProbe(childProps: Props) (implicit system: ActorSystem) = { val proxy = TestProbe() system.actorOf(Props(new Actor { val child = context.actorOf(childProps) def receive = { case x if sender == child => proxy.ref forward x case x => child forward x } })) proxy } }The trait can be mixed into test scenario like in example from (Link)
class ProcreatorActorTest extends TestKit(ActorSystem("ProcreatorTestActorSystem")) with ImplicitSender with WordSpecLike with StopSystemAfterAll with TestParentChildRelation { "A Procreator actor" must { "recombine the genome" in { val maleGenotype = SampleGenome(Seq(1, 3, 3, 7, 1)) val femaleGenotype = SampleGenome(Seq(9, 8, 7, 6, 5)) val male = TestActorRef(new Phenotype(maleGenotype)) val female = TestActorRef(new Phenotype(femaleGenotype)) val proxy = mockParentWithProbe(Props( new TestRecombineProcreator(male, female, 1.0))) val expectedGenome = SampleGenome(Seq(1, 3, 7, 6, 5)) proxy.expectMsg(Descendant(expectedGenome)) } }Examples come from https://github.com/ppiotrow/scalagen project. I'm waiting for your feedback
xclip -sel clip < ~/.ssh/id_rsa.pub
None of the result expressions in a CASE specification can be NULL
UPDATE MY_TABLE SET MY_COLUMN = CASE ID WHEN 99 THEN null WHEN 100 THEN null END
UPDATE MY_TABLE SET MY_COLUMN = CASE ID WHEN 99 THEN null WHEN 100 THEN null ELSE MY_COLUMN END