-
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
0 parents
commit 3cb74c9
Showing
7 changed files
with
118 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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
target/ | ||
lib_managed/ | ||
src_managed/ | ||
project/boot/ | ||
project/plugins/project/ | ||
.history | ||
.cache | ||
.lib/ | ||
*.class | ||
*.log | ||
.idea |
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,38 @@ | ||
name := "testing-without-mocking" | ||
|
||
version := "0.1" | ||
|
||
scalaVersion := "2.12.8" | ||
|
||
scalacOptions ++= Seq( | ||
"-deprecation", // Emit warning and location for usages of deprecated APIs. | ||
"-explaintypes", // Explain type errors in more detail. | ||
"-feature", // Emit warning and location for usages of features that should be imported explicitly. | ||
"-unchecked", // Enable additional warnings where generated code depends on assumptions. | ||
"-Xcheckinit", // Wrap field accessors to throw an exception on uninitialized access. | ||
"-language:higherKinds", | ||
"-Ypartial-unification", | ||
) | ||
|
||
val compilerPlugins = Seq( | ||
compilerPlugin("io.tryp" % "splain" % "0.3.5" cross CrossVersion.patch), | ||
compilerPlugin("com.softwaremill.clippy" %% "plugin" % "0.5.3" classifier "bundle"), | ||
compilerPlugin("org.spire-math" %% "kind-projector" % "0.9.8"), | ||
compilerPlugin("com.olegpy" %% "better-monadic-for" % "0.2.4") | ||
) | ||
|
||
val cats = Seq( | ||
"org.typelevel" %% "cats-core" % "1.5.0", | ||
"org.typelevel" %% "cats-mtl-core" % "0.4.0", | ||
"org.typelevel" %% "cats-effect" % "1.2.0", | ||
"org.typelevel" %% "cats-tagless-macros" % "0.1.0", | ||
"com.olegpy" %% "meow-mtl" % "0.2.0", | ||
) | ||
|
||
val scalatest = Seq( | ||
"org.scalactic" %% "scalactic" % "3.0.4", | ||
"org.scalatest" %% "scalatest" % "3.0.5", | ||
"com.ironcorelabs" %% "cats-scalatest" % "2.3.1" | ||
).map(_ % Test) | ||
|
||
libraryDependencies ++= compilerPlugins ++ cats ++ scalatest |
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 = 1.2.8 |
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,11 @@ | ||
package orders | ||
import orders.domain.Order | ||
|
||
trait OrderRepository[F[_]] { | ||
def find(id: Order.Id): F[Option[Order]] | ||
def save(order: Order): F[Unit] | ||
} | ||
|
||
object OrderRepository { | ||
def apply[F[_]](implicit ev: OrderRepository[F]): OrderRepository[F] = ev | ||
} |
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,9 @@ | ||
package orders | ||
|
||
import orders.domain.Order | ||
|
||
trait Orders[F[_]] { | ||
def completeIfPossible(id: Order.Id): F[Option[Order]] | ||
} | ||
|
||
object Orders {} |
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,21 @@ | ||
package orders | ||
|
||
import orders.domain.Order.Id | ||
import orders.domain.Order.Status | ||
|
||
object domain { | ||
|
||
case class Order(id: Id, status: Status) | ||
|
||
object Order { | ||
case class Id(value: String) extends AnyVal | ||
|
||
sealed trait Status extends Product with Serializable | ||
|
||
object Status { | ||
case object Initial extends Status | ||
case object InProgress extends Status | ||
case object Complete extends Status | ||
} | ||
} | ||
} |
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,27 @@ | ||
package orders | ||
|
||
import orders.domain.Order | ||
import orders.domain.Order.Status.Complete | ||
import orders.domain.Order.Status.InProgress | ||
import orders.domain.Order.Status.Initial | ||
import org.scalatest.Matchers | ||
import org.scalatest.WordSpec | ||
|
||
class OrdersSpec extends WordSpec with Matchers { | ||
|
||
val OrderId = Order.Id("123") | ||
val OrderInInitialStatus = Order(OrderId, Initial) | ||
val OrderInProgressStatus = Order(OrderId, InProgress) | ||
val OrderInCompleteStatus = Order(OrderId, Complete) | ||
|
||
"Order completion" when { | ||
"order is initial status" should { | ||
"not complete the order" in {} | ||
} | ||
|
||
"order is in progress" should { | ||
"complete order" in {} | ||
} | ||
} | ||
|
||
} |