Skip to content

Commit

Permalink
First Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
chobeat committed Aug 11, 2017
1 parent 6e0052f commit 9accfc1
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .gitignore
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/

17 changes: 17 additions & 0 deletions build.sbt
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



)
6 changes: 6 additions & 0 deletions project/Dependencies.scala
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"
}
1 change: 1 addition & 0 deletions project/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sbt.version=0.13.16
17 changes: 17 additions & 0 deletions src/main/scala/validator/Validator.scala
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)
}
}
14 changes: 14 additions & 0 deletions src/test/scala/validator/ValidatorSpec.scala
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()))
}
}

0 comments on commit 9accfc1

Please sign in to comment.