Skip to content

Commit

Permalink
test: Add nowarn annotation to test
Browse files Browse the repository at this point in the history
Because it is a test of deprecated API
  • Loading branch information
tksugimoto committed Jul 15, 2021
1 parent a5968fe commit 11bdd76
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import lerna.akka.entityreplication.ReplicationActorSpec.{ config, ExampleReplic
import lerna.akka.entityreplication.model.EntityInstanceId
import lerna.akka.entityreplication.raft.model.{ EntityEvent, LogEntry, LogEntryIndex, Term }
import lerna.akka.entityreplication.raft.{ ActorSpec, RaftProtocol }

import java.util.concurrent.atomic.AtomicInteger
import scala.annotation.nowarn

object ReplicationActorSpec {

Expand All @@ -29,6 +31,7 @@ object ReplicationActorSpec {
case class Counted() extends Event
}

@nowarn // for deprecated ReplicationActor
class ExampleReplicationActor extends ReplicationActor[Int] {
import ExampleReplicationActor._

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import lerna.akka.entityreplication.{ ReplicationActor, ReplicationRegion }
import lerna.akka.entityreplication.testkit.TestReplicationActorPropsSpec.WordCountReplicationActor
import org.scalatest.{ Matchers, WordSpecLike }

import scala.annotation.nowarn

object TestReplicationActorPropsSpec {

object WordCountReplicationActor {
Expand All @@ -22,6 +24,7 @@ object TestReplicationActorPropsSpec {
final case class Counted(wordCount: Int) extends DomainEvent
}

@nowarn // for deprecated ReplicationActor
class WordCountReplicationActor extends ReplicationActor[Int] {
import WordCountReplicationActor._

Expand Down Expand Up @@ -60,19 +63,22 @@ class TestReplicationActorPropsSpec extends TestKit(ActorSystem()) with WordSpec
"TestReplicationActorProps" should {

"take in only ReplicationActor Props" in {
@nowarn // for deprecated TestReplicationActorProps
val ex = intercept[IllegalArgumentException] {
TestReplicationActorProps(Props.default)
}
ex.getMessage should be(s"The Props for [${Props.default.actorClass()}] doesn't provide ReplicationActor")
}

"forward commands to ReplicationActor" in {
@nowarn // for deprecated TestReplicationActorProps
val actor = system.actorOf(TestReplicationActorProps(WordCountReplicationActor.props))
actor ! CountWord("hello")
expectMsg(Counted(wordCount = "hello".length))
}

"allow that ReplicationActor process ensureConsistency" in {
@nowarn // for deprecated TestReplicationActorProps
val actor = system.actorOf(TestReplicationActorProps(WordCountReplicationActor.props))
actor ! CountWord("hello")
expectMsgType[Counted]
Expand All @@ -81,6 +87,7 @@ class TestReplicationActorPropsSpec extends TestKit(ActorSystem()) with WordSpec
}

"allow to check ReplicationActor passivation" in {
@nowarn // for deprecated TestReplicationActorProps
val actor = watch(system.actorOf(TestReplicationActorProps(WordCountReplicationActor.props)))
actor ! Stop() // Passivate

Expand Down

0 comments on commit 11bdd76

Please sign in to comment.