Permalink
Browse files

Ref #872 #873: Remove junit dependency, makes names more consistent

  • Loading branch information...
1 parent 395c617 commit 8a666675ee37aae7dac3b7ea56c63632216fa5e4 @indrajitr indrajitr committed Feb 24, 2011
Showing with 149 additions and 122 deletions.
  1. +11 −6 core/json-ext/src/test/scala/net/liftweb/json/ext/JodaTimeSerializerSpec.scala
  2. +9 −5 core/json-ext/src/test/scala/net/liftweb/json/ext/JsonBoxSerializerSpec.scala
  3. +2 −2 core/json/README.md
  4. +7 −5 core/json/src/test/scala/net/liftweb/json/DiffExamples.scala
  5. +2 −3 core/json/src/test/scala/net/liftweb/json/Examples.scala
  6. +6 −4 core/json/src/test/scala/net/liftweb/json/ExtractionBugs.scala
  7. +6 −4 core/json/src/test/scala/net/liftweb/json/{ExtractionExamples.scala → ExtractionExamplesSpec.scala}
  8. +7 −6 core/json/src/test/scala/net/liftweb/json/{JsonASTTest.scala → JsonAstSpec.scala}
  9. +5 −5 core/json/src/test/scala/net/liftweb/json/{FormatsExamples.scala → JsonFormatsSpec.scala}
  10. +8 −7 core/json/src/test/scala/net/liftweb/json/{ParserTest.scala → JsonParserSpec.scala}
  11. +7 −6 core/json/src/test/scala/net/liftweb/json/{PrintingTest.scala → JsonPrintingSpec.scala}
  12. +5 −3 core/json/src/test/scala/net/liftweb/json/{QueryExamples.scala → JsonQueryExamples.scala}
  13. +8 −7 core/json/src/test/scala/net/liftweb/json/{XmlTest.scala → JsonXmlSpec.scala}
  14. +6 −4 core/json/src/test/scala/net/liftweb/json/LottoExample.scala
  15. +4 −4 core/json/src/test/scala/net/liftweb/json/MergeExamples.scala
  16. +4 −4 core/json/src/test/scala/net/liftweb/json/ParserBugs.scala
  17. +21 −3 core/json/src/test/scala/net/liftweb/json/{PullParserExample.scala → PullParserExamples.scala}
  18. +4 −8 core/json/src/test/scala/net/liftweb/json/SerializationBugs.scala
  19. +1 −2 core/json/src/test/scala/net/liftweb/json/SerializationExamples.scala
  20. +2 −3 core/json/src/test/scala/net/liftweb/json/XmlBugs.scala
  21. +6 −4 core/json/src/test/scala/net/liftweb/json/XmlExamples.scala
  22. +9 −14 web/webkit/src/test/scala/net/liftweb/http/{FactorySpec.scala → FactoryMakerSpec.scala}
  23. +9 −13 web/webkit/src/test/scala/net/liftweb/sitemap/{MenuSpec.scala → MenuDSLSpec.scala}
  24. 0 web/webkit/src/test/scala/net/liftweb/webapptest/{MemoizeTest.scala → MemoizeSpec.scala}
@@ -1,5 +1,5 @@
/*
- * Copyright 2007-2010 WorldWide Conferencing, LLC
+ * Copyright 2007-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,14 +18,19 @@ package net.liftweb
package json
package ext
-import _root_.org.specs._
-import _root_.org.specs.runner._
+import org.joda.time._
+
+import org.specs.Specification
+
import common._
import json.Serialization.{read, write => swrite}
-import org.joda.time._
-class JodaTimeSerializerSpecTest extends JUnit4(JodaTimeSerializerSpec)
-object JodaTimeSerializerSpec extends Specification {
+
+/**
+ * System under specification for JodaTimeSerializer.
+ */
+object JodaTimeSerializerSpec extends Specification("JodaTimeSerializer Specification") {
+
implicit val formats = Serialization.formats(NoTypeHints) ++ JodaTimeSerializers.all
"Serialize joda time types" in {
@@ -1,5 +1,5 @@
/*
- * Copyright 2007-2010 WorldWide Conferencing, LLC
+ * Copyright 2007-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,13 +18,17 @@ package net.liftweb
package json
package ext
-import _root_.org.specs._
-import _root_.org.specs.runner._
+import org.specs.Specification
+
import common._
import json.Serialization.{read, write => swrite}
-class JsonBoxSerializerSpecTest extends JUnit4(JsonBoxSerializerSpec)
-object JsonBoxSerializerSpec extends Specification {
+
+/**
+ * System under specification for JsonBoxSerializer.
+ */
+object JsonBoxSerializerSpec extends Specification("JsonBoxSerializer Specification") {
+
implicit val formats = net.liftweb.json.DefaultFormats + new JsonBoxSerializer
"Extract empty age" in {
View
@@ -240,7 +240,7 @@ Querying JSON
------------
JSON values can be extracted using for-comprehensions.
-Please see more examples in src/test/scala/net/liftweb/json/QueryExamples.scala
+Please see more examples in src/test/scala/net/liftweb/json/JsonQueryExamples.scala
scala> import net.liftweb.json._
scala> val json = parse("""
@@ -386,7 +386,7 @@ Extracting values
Case classes can be used to extract values from parsed JSON. Non-existing values
can be extracted into scala.Option and strings can be automatically converted into
java.util.Dates.
-Please see more examples in src/test/scala/net/liftweb/json/ExtractionExamples.scala
+Please see more examples in src/test/scala/net/liftweb/json/ExtractionExamplesSpec.scala
scala> import net.liftweb.json._
scala> implicit val formats = DefaultFormats // Brings in default date formats etc.
@@ -1,5 +1,5 @@
/*
- * Copyright 2009-2010 WorldWide Conferencing, LLC
+ * Copyright 2009-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,10 +18,12 @@ package net.liftweb
package json
import org.specs.Specification
-import org.specs.runner.{Runner, JUnit}
-class DiffExamplesTest extends Runner(DiffExamples) with JUnit
-object DiffExamples extends Specification {
+
+/**
+ * System under specification for Diff Examples.
+ */
+object DiffExamples extends Specification("Diff Examples") {
import MergeExamples.{scala1, scala2, lotto1, lotto2, mergedLottoResult}
"Diff example" in {
@@ -71,5 +73,5 @@ object DiffExamples extends Specification {
}
private def read(resource: String) =
- parse(scala.io.Source.fromInputStream(classOf[DiffExamplesTest].getResourceAsStream(resource)).getLines().mkString)
+ parse(scala.io.Source.fromInputStream(getClass.getResourceAsStream(resource)).getLines().mkString)
}
@@ -1,5 +1,5 @@
/*
- * Copyright 2009-2010 WorldWide Conferencing, LLC
+ * Copyright 2009-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,9 +18,8 @@ package net.liftweb
package json
import org.specs.Specification
-import org.specs.runner.{Runner, JUnit}
-class ExampleTest extends Runner(Examples) with JUnit
+
object Examples extends Specification {
import JsonAST.concat
import JsonDSL._
@@ -1,5 +1,5 @@
/*
- * Copyright 2009-2010 WorldWide Conferencing, LLC
+ * Copyright 2009-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,10 +18,12 @@ package net.liftweb
package json
import org.specs.Specification
-import org.specs.runner.{Runner, JUnit}
-class ExtractionBugsTest extends Runner(ExtractionBugs) with JUnit
-object ExtractionBugs extends Specification {
+
+/**
+ * System under specification for Extraction bugs.
+ */
+object ExtractionBugs extends Specification("Extraction bugs Specification") {
implicit val formats = DefaultFormats
"ClassCastException (BigInt) regression 2 must pass" in {
@@ -1,5 +1,5 @@
/*
- * Copyright 2009-2010 WorldWide Conferencing, LLC
+ * Copyright 2009-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,10 +19,12 @@ package json
import java.util.Date
import org.specs.Specification
-import org.specs.runner.{Runner, JUnit}
-class ExtractionExampleTest extends Runner(ExtractionExamples) with JUnit
-object ExtractionExamples extends Specification {
+
+/**
+ * Systems under specification for Extraction Examples.
+ */
+object ExtractionExamples extends Specification("Extraction Examples Specification") {
implicit val formats = DefaultFormats
"Extraction example" in {
@@ -1,5 +1,5 @@
/*
- * Copyright 2009-2010 WorldWide Conferencing, LLC
+ * Copyright 2009-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,14 +17,15 @@
package net.liftweb
package json
+import org.specs.{ScalaCheck, Specification}
import org.scalacheck._
import org.scalacheck.Prop.{forAll, forAllNoShrink}
-import org.specs.Specification
-import org.specs.runner.{Runner, JUnit}
-import org.specs.ScalaCheck
-class JsonASTTest extends Runner(JsonASTSpec) with JUnit
-object JsonASTSpec extends Specification with JValueGen with ScalaCheck {
+
+/**
+ * System under specification for JSON AST.
+ */
+object JsonAstSpec extends Specification("JSON AST Specification") with JValueGen with ScalaCheck {
"Functor identity" in {
val identityProp = (json: JValue) => json == (json map identity)
forAll(identityProp) must pass
@@ -1,5 +1,5 @@
/*
- * Copyright 2009-2010 WorldWide Conferencing, LLC
+ * Copyright 2009-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,13 +17,13 @@
package net.liftweb
package json
-import java.util.Date
import org.specs.Specification
-import org.specs.runner.{Runner, JUnit}
-class FormatsExamplesTest extends Runner(FormatsExamples) with JUnit
-object FormatsExamples extends Specification with TypeHintExamples {
+/**
+ * System under specification for JSON Formats.
+ */
+object JsonFormatsSpec extends Specification("JsonFormats Specification") with TypeHintExamples {
implicit val formats = ShortTypeHintExamples.formats + FullTypeHintExamples.formats.typeHints
val hintsForFish = ShortTypeHintExamples.formats.typeHints.hintFor(classOf[Fish])
@@ -1,5 +1,5 @@
/*
- * Copyright 2009-2010 WorldWide Conferencing, LLC
+ * Copyright 2009-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,14 +17,15 @@
package net.liftweb
package json
-import org.scalacheck._
+import org.specs.{ScalaCheck, Specification}
+import org.scalacheck.{Arbitrary, Gen}
import org.scalacheck.Prop._
-import org.specs.Specification
-import org.specs.runner.{Runner, JUnit}
-import org.specs.ScalaCheck
-class ParserTest extends Runner(ParserSpec) with JUnit
-object ParserSpec extends Specification with JValueGen with ScalaCheck {
+
+/**
+ * System under specification for JSON Parser.
+ */
+object JsonParserSpec extends Specification("JSON Parser Specification") with JValueGen with ScalaCheck {
"Any valid json can be parsed" in {
val parsing = (json: JValue) => { parse(Printer.pretty(render(json))); true }
forAll(parsing) must pass
@@ -17,14 +17,15 @@
package net.liftweb
package json
-import org.scalacheck._
+import org.specs.{ScalaCheck, Specification}
+import org.scalacheck.Arbitrary
import org.scalacheck.Prop.forAll
-import org.specs.Specification
-import org.specs.runner.{Runner, JUnit}
-import org.specs.ScalaCheck
-class PrintingTest extends Runner(PrintingSpec) with JUnit
-object PrintingSpec extends Specification with JValueGen with ScalaCheck {
+
+/**
+ * System under specification for JSON Printing.
+ */
+object JsonPrintingSpec extends Specification("JSON Printing Specification") with JValueGen with ScalaCheck {
import scala.text.Document
"rendering does not change semantics" in {
@@ -18,10 +18,12 @@ package net.liftweb
package json
import org.specs.Specification
-import org.specs.runner.{Runner, JUnit}
-class QueryExamplesTest extends Runner(QueryExamples) with JUnit
-object QueryExamples extends Specification {
+
+/**
+ * System under specification for JSON Query Examples.
+ */
+object JsonQueryExamples extends Specification("JSON Query Examples") {
"List of IPs" in {
val ips = for { JString(ip) <- json \\ "ip" } yield ip
ips mustEqual List("192.168.1.125", "192.168.1.126", "192.168.1.127", "192.168.2.125", "192.168.2.126")
@@ -1,5 +1,5 @@
/*
- * Copyright 2009-2010 WorldWide Conferencing, LLC
+ * Copyright 2009-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,14 +17,15 @@
package net.liftweb
package json
-import org.scalacheck._
+import org.specs.{ScalaCheck, Specification}
+import org.scalacheck.Arbitrary
import org.scalacheck.Prop.forAll
-import org.specs.Specification
-import org.specs.runner.{Runner, JUnit}
-import org.specs.ScalaCheck
-class XmlTest extends Runner(XmlSpec) with JUnit
-object XmlSpec extends Specification with NodeGen with JValueGen with ScalaCheck {
+
+/**
+ * System under specification for JSON XML.
+ */
+object JsonXmlSpec extends Specification("JSON XML Specification") with NodeGen with JValueGen with ScalaCheck {
import Xml._
import scala.xml.Node
@@ -1,5 +1,5 @@
/*
- * Copyright 2009-2010 WorldWide Conferencing, LLC
+ * Copyright 2009-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,10 +18,12 @@ package net.liftweb
package json
import org.specs.Specification
-import org.specs.runner.{Runner, JUnit}
-class LottoExampleTest extends Runner(LottoExample) with JUnit
-object LottoExample extends Specification {
+
+/**
+ * System under specification for Lotto Examples.
+ */
+object LottoExample extends Specification("Lotto Examples") {
import JsonDSL._
implicit val formats = DefaultFormats
@@ -1,5 +1,5 @@
/*
- * Copyright 2009-2010 WorldWide Conferencing, LLC
+ * Copyright 2009-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,10 +18,10 @@ package net.liftweb
package json
import org.specs.Specification
-import org.specs.runner.{Runner, JUnit}
-class MergeExamplesTest extends Runner(MergeExamples) with JUnit
-object MergeExamples extends Specification {
+
+
+object MergeExamples extends Specification("Merge Examples") {
"Merge example" in {
(scala1 merge scala2) mustEqual expectedMergeResult
}
@@ -1,5 +1,5 @@
/*
- * Copyright 2009-2010 WorldWide Conferencing, LLC
+ * Copyright 2009-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,11 +17,11 @@
package net.liftweb
package json
+import util.control.Exception._
+
import org.specs.Specification
-import org.specs.runner.{Runner, JUnit}
-import scala.util.control.Exception._
-class ParserBugsTest extends Runner(ParserBugs) with JUnit
+
object ParserBugs extends Specification {
"Unicode ffff is a valid char in string literal" in {
parseOpt(""" {"x":"\uffff"} """).isDefined mustEqual true
Oops, something went wrong.

0 comments on commit 8a66667

Please sign in to comment.