Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added a Spec for SoftReferenceCache testing basic functionality.

  • Loading branch information...
commit fb413764afc48458f6d2eb330caec5ee33b267f4 1 parent 688db00
@davewhittaker davewhittaker authored fmpwizard committed
View
28 core/util/src/test/scala/net/liftweb/util/SoftReferenceCacheSpec.scala
@@ -0,0 +1,28 @@
+package net.liftweb.util
+
+import org.specs2.mutable._
+import net.liftweb.common._
+import org.specs2.specification.AroundExample
+
+object SoftReferenceCacheSpec extends Specification {
+
+ sequential
+
+ object cache extends SoftReferenceCache[String, String](1)
+
+ "SoftReferenceCache " should {
+ "Accept additions" in {
+ cache += ("test" -> "test")
+ cache.keys.size() must_== 1
+ }
+ "Allow objects to be retrieved" in {
+ val cached = cache("test")
+ cached must beLike { case Full("test") => ok }
+ }
+ "Properly age out entries" in {
+ cache += ("test2" -> "test2")
+ cache("test") must_== Empty
+ }
+ }
+
+}
Please sign in to comment.
Something went wrong with that request. Please try again.