{"action":"created","issue":{"url":"https://api.github.com/repos/rickynils/scalacheck/issues/202","labels_url":"https://api.github.com/repos/rickynils/scalacheck/issues/202/labels{/name}","comments_url":"https://api.github.com/repos/rickynils/scalacheck/issues/202/comments","events_url":"https://api.github.com/repos/rickynils/scalacheck/issues/202/events","html_url":"https://github.com/rickynils/scalacheck/issues/202","id":114422625,"number":202,"title":"Using Stateful Testing, specific compilation error occur.","user":{"login":"bababa12345","id":15523455,"avatar_url":"https://avatars.githubusercontent.com/u/15523455?v=3","gravatar_id":"","url":"https://api.github.com/users/bababa12345","html_url":"https://github.com/bababa12345","followers_url":"https://api.github.com/users/bababa12345/followers","following_url":"https://api.github.com/users/bababa12345/following{/other_user}","gists_url":"https://api.github.com/users/bababa12345/gists{/gist_id}","starred_url":"https://api.github.com/users/bababa12345/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bababa12345/subscriptions","organizations_url":"https://api.github.com/users/bababa12345/orgs","repos_url":"https://api.github.com/users/bababa12345/repos","events_url":"https://api.github.com/users/bababa12345/events{/privacy}","received_events_url":"https://api.github.com/users/bababa12345/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-31T17:25:45Z","updated_at":"2015-11-06T07:58:36Z","closed_at":"2015-11-04T10:22:03Z","body":"I tried \"Stateful Testing\" for some of examples. I made reference to the cases, such as\r\ncommand-leveldb, because the example on User Guide was correspond to the old scalacheck version.\r\nI written forrowing Counter example to match the new scalacheck version.\r\n```\r\nimport org.scalacheck.Gen\r\nimport org.scalacheck.Arbitrary.arbitrary\r\nimport org.scalacheck.commands.Commands\r\n\r\nimport scala.util.{Try, Success}\r\nimport scala.collection.immutable.Map\r\nimport scala.collection.immutable._\r\n\r\nclass Counter{\r\n var n = 0\r\n def inc= n += 1\r\n def dec= n -= 1\r\n def get = n\r\n def reset= n = 0\r\n}\r\nobject CommandsCounter extends org.scalacheck.Properties(\"CommandsCounter\") {\r\n\r\n property(\"counterspec\") = CounterSpec.property()\r\n\r\n}\r\n\r\nobject CounterSpec extends Commands{\r\n type Sut = Counter\r\n case class State(n: Int) \r\n\r\n def canCreateNewSut(newState: State, initSuts: Traversable[State],\r\n    runningSuts: Traversable[Sut]\r\n  ): Boolean = {\r\n    initSuts.isEmpty && runningSuts.isEmpty\r\n }\r\n def newSut(state: State): Sut = new Counter\r\n def destroySut(sut: Sut):Unit = sut.reset\r\n def initialPreCondition(state: State):Boolean = true\r\n val genInitialState : Gen[State] = State(0)\r\n def genCommand(state: State): Gen[Command] = Gen.oneOf(Inc, Dec, Get)\r\n\r\n case object Inc extends UnitCommand {\r\n  def run(sut: Sut) = sut.inc\r\n  def preCondition(state: State) = true\r\n  def nextState(state: State) = State(state.n + 1)\r\n  def postCondition(state: State, success: Boolean) = success\r\n }\r\n\r\n case object Dec extends UnitCommand {\r\n  def run(sut: Sut) = sut.dec\r\n  def preCondition(state: State) = true\r\n  def nextState(state: State) = State(state.n - 1)\r\n  def postCondition(state: State, success: Boolean) = success\r\n }\r\n\r\n case object Get extends Command {\r\n  type Result = Int\r\n  def run(sut: Sut) = sut.get\r\n  def preCondition(state: State) = true\r\n  def nextState(state: State) = State(state.n)\r\n  def postCondition(state: State, result: Try[Int])={result==Success(state.n)}\r\n }\r\n}\r\n```\r\nI tested above example on sbt, but I got forrowing compilation error.\r\n\r\n```\r\nC:\\Users\\***\\Desktop\\CounterTest>sbt test\r\n[info] Set current project to Counter (in build file:/C:/Users/owner/Desktop/Cou\r\nnterTest/)\r\n[info] Compiling 1 Scala source to C:\\Users\\***\\Desktop\\CounterTest\\target\\sca\r\nla-2.11\\test-classes...\r\n[error] C:\\Users\\***\\Desktop\\CounterTest\\src\\test\\scala\\CounterTest.scala:23:\r\nobject creation impossible, since method canCreateNewSut in trait Commands of ty\r\npe (newState: CounterSpec.State, initSuts: Traversable[CounterSpec.State], runni\r\nngSuts: Traversable[CounterSpec.Sut])Boolean is not defined\r\n[error] object CounterSpec extends Commands{\r\n[error]        ^\r\n[error] one error found\r\n[error] (test:compile) Compilation failed\r\n```\r\nEven though I defined \"canCreateNewSut\", I got this error that \"canCreateNewSut\"\r\nis not defined. I got this error when I tested not only Counter example but also all examples\r\n I tried, but this error didn't occured when I tested commands-leveldb example.\r\nWhy this error occured?"},"comment":{"url":"https://api.github.com/repos/rickynils/scalacheck/issues/comments/154339399","html_url":"https://github.com/rickynils/scalacheck/issues/202#issuecomment-154339399","issue_url":"https://api.github.com/repos/rickynils/scalacheck/issues/202","id":154339399,"user":{"login":"bababa12345","id":15523455,"avatar_url":"https://avatars.githubusercontent.com/u/15523455?v=3","gravatar_id":"","url":"https://api.github.com/users/bababa12345","html_url":"https://github.com/bababa12345","followers_url":"https://api.github.com/users/bababa12345/followers","following_url":"https://api.github.com/users/bababa12345/following{/other_user}","gists_url":"https://api.github.com/users/bababa12345/gists{/gist_id}","starred_url":"https://api.github.com/users/bababa12345/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bababa12345/subscriptions","organizations_url":"https://api.github.com/users/bababa12345/orgs","repos_url":"https://api.github.com/users/bababa12345/repos","events_url":"https://api.github.com/users/bababa12345/events{/privacy}","received_events_url":"https://api.github.com/users/bababa12345/received_events","type":"User","site_admin":false},"created_at":"2015-11-06T07:58:36Z","updated_at":"2015-11-06T07:58:36Z","body":"Sorry, above reason seems to be wrong.\r\nWhen test code imported \"scala.collection.immutable._\" run, this error occued."}}