0

i am trying to run a simple ScalaTest app to understand the scala testing my code is:

 package org.scalatest.examples.flatspec
 import org.scalatest.FlatSpec
 import collection.mutable.Stack
 import org.scalatest._
 class ExampleSpec extends FlatSpec with Matchers {
 "A Stack" should "pop values in last-in-first-out order" in {
  val stack = new Stack[Int]
stack.push(1)
stack.push(2)
stack.pop() should be (2)
stack.pop() should be (1)
}

it should "throw NoSuchElementException if an empty stack is popped" in {
val emptyStack = new Stack[Int]
a [NoSuchElementException] should be thrownBy {
  emptyStack.pop()
} 
}
}

i have also downloaded scalatest_2.11-2.2.4.jar. i am compiling the file using command

 scalac -cp scalatest_2.11-2.2.4.jar ExampleSpec.scala

and facing the following error

 error while loading package, class file needed by package is missing.
 reference value <init>$default$2 of object deprecated refers to nonexisting symbol.
Tahir
  • 39
  • 5
  • see http://stackoverflow.com/questions/23974896/scalatest-spec-compilation-error – Identity1 Dec 23 '15 at 06:49
  • 2
    the error arises when you compile? I don't have that error when compiling. Provide scalac -version – nikiforo Dec 23 '15 at 06:51
  • got the answer. actually i was using scala 2.9 version now i updated it to 2.10 then their is no compilation error. thanx – Tahir Dec 23 '15 at 10:00
  • @nikiforo i while i am trying to execute following error occurred and system stuck after that An exception or error caused a run to abort. This may have been caused by a problematic custom reporter. java.lang.NoSuchMethodError: scala.runtime.ObjectRef.create(Ljava/lang/Object;)Lscala/runtime/Obje ctRef; at org.scalatest.tools.Runner$.doRunRunRunDaDoRunRun(Runner.scala:2347) at org.scalatest.tools.Runner$$anonfun$runOptionallyWithPassFailReporter – Tahir Dec 23 '15 at 10:25

0 Answers0