mockless

Mockless - make empty instances of your ADTs

License

License

GroupId

GroupId

com.gu
ArtifactId

ArtifactId

mockless_2.10
Last Version

Last Version

0.1
Release Date

Release Date

Type

Type

jar
Description

Description

mockless
Mockless - make empty instances of your ADTs
Project URL

Project URL

https://github.com/guardian/mockless
Project Organization

Project Organization

com.gu
Source Code Management

Source Code Management

https://github.com/guardian/mockless

Download mockless_2.10

How to add to project

<!-- https://jarcasting.com/artifacts/com.gu/mockless_2.10/ -->
<dependency>
    <groupId>com.gu</groupId>
    <artifactId>mockless_2.10</artifactId>
    <version>0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.gu/mockless_2.10/
implementation 'com.gu:mockless_2.10:0.1'
// https://jarcasting.com/artifacts/com.gu/mockless_2.10/
implementation ("com.gu:mockless_2.10:0.1")
'com.gu:mockless_2.10:jar:0.1'
<dependency org="com.gu" name="mockless_2.10" rev="0.1">
  <artifact name="mockless_2.10" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.gu', module='mockless_2.10', version='0.1')
)
libraryDependencies += "com.gu" % "mockless_2.10" % "0.1"
[com.gu/mockless_2.10 "0.1"]

Dependencies

compile (2)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.10.4
com.chuusai : shapeless_2.10.4 jar 2.0.0

test (1)

Group / Artifact Type Version
org.specs2 : specs2_2.10 jar 2.4.2

Project Modules

There are no modules declared in this project.

Mockless

Introduces the Empty typeclass, which provides an 'empty' value for a given type. Also includes automatic derivation of Empty for case classes. Writing tests has never been so easy!

Usage

import com.gu.mockless.Empty.auto._
import com.gu.mockless.Empty.{empty => emptyInstance}

object Book {
  lazy val empty = emptyInstance[Book]
  
  assert(empty == Book(
    "",
    0,
    Nil,
    Map.empty
  )) // true 
}

case class Book(
  title: String,
  yearPublished: Int,
  authors: List[Author],
  references: Map[String, String]
)
com.gu

The Guardian

The source code of the world's leading liberal voice

Versions

Version
0.1