Skip to content

Commit

Permalink
resolves #55
Browse files Browse the repository at this point in the history
  • Loading branch information
barkhorn committed May 6, 2017
1 parent a918e12 commit 1d42df0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion core/shared/src/main/scala/org/scalamock/context/CallLog.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,16 @@ package org.scalamock.context
import scala.collection.mutable.ListBuffer

private[scalamock] class CallLog {
private val warnInterval = sys.props.get("scalamock.calls.warn").map(_.toInt).getOrElse(Int.MaxValue)
private var warnThreshold = warnInterval

def +=(call: Call) = this.synchronized { log += call }
def +=(call: Call) = this.synchronized {
if (log.size > warnThreshold) {
println(s"ScalaMock - warning: high number of calls recorded (>$warnThreshold). This may be a bug in your test suite")
warnThreshold += warnInterval
}
log += call
}

def foreach(f: Call => Unit) = log foreach f

Expand Down

0 comments on commit 1d42df0

Please sign in to comment.