-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,15 @@ | ||
*.class | ||
*.log | ||
.idea/ | ||
# mpeltonen/sbt-idea plugin | ||
.idea_modules/ | ||
dist/* | ||
target/ | ||
lib_managed/ | ||
src_managed/ | ||
project/boot/ | ||
project/plugins/project/ | ||
.history | ||
.cache | ||
.lib/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import Dependencies._ | ||
|
||
lazy val root = (project in file(".")). | ||
settings( | ||
inThisBuild(List( | ||
organization := "com.example", | ||
scalaVersion := "2.12.3", | ||
version := "0.1.0-SNAPSHOT" | ||
)), | ||
name := "Hello", | ||
libraryDependencies += scalaTest % Test, | ||
|
||
libraryDependencies += json4s | ||
|
||
|
||
|
||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import sbt._ | ||
|
||
object Dependencies { | ||
lazy val scalaTest = "org.scalatest" %% "scalatest" % "3.0.3" | ||
lazy val json4s = "org.json4s" %% "json4s-jackson" % "3.5.3" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sbt.version=0.13.16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package validator | ||
import org.json4s._ | ||
import org.json4s.jackson.JsonMethods._ | ||
|
||
import scala.util.{Success, Try} | ||
|
||
/** | ||
* Created by simone on 11.08.17. | ||
*/ | ||
object Validator { | ||
|
||
def validate(s:String):Try[JValue]={ | ||
val result = parse(s) | ||
|
||
Success(result) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package validator | ||
|
||
import org.json4s.JValue | ||
import org.json4s.JsonAST.JObject | ||
import org.scalatest._ | ||
|
||
import scala.util.Success | ||
|
||
class ValidatorSpec extends FlatSpec with Matchers { | ||
"The Validator object" should "return a Success(JValue)" in { | ||
val input = "{}" | ||
Validator.validate(input) shouldEqual Success(JObject(List())) | ||
} | ||
} |