dummies

Create Java/Scala mock objects with real content

License

License

GroupId

GroupId

com.simplaex
ArtifactId

ArtifactId

dummies
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

dummies
Create Java/Scala mock objects with real content
Project URL

Project URL

https://github.com/simplaex/dummies
Project Organization

Project Organization

Simplaex GmbH
Source Code Management

Source Code Management

https://github.com/simplaex/dummies

Download dummies

How to add to project

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

Dependencies

provided (1)

Group / Artifact Type Version
org.projectlombok : lombok jar 1.16.18

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

easy dummies for Java/Scala

Setup

Java/Maven

<dependency>
  <groupId>com.simplaex</groupId>
  <artifactId>dummies</artifactId>
  <version>1.0.0</version>
</dependency>

Scala/SBT

libraryDependencies += "com.simplaex" % "dummies" % "1.0.0"

Examples

Java/Lombok

public class JavaExampleWithLombok {

  public static void main(final String... args) {

    val record1 = Dummies.get().create(Record.class);
    val record2 = Dummies.get().fill(new Record());

    val user = Dummies.get().create(User.class);

    System.out.println(record1);
    // -> JavaExample.Record(
    //      id=c235b645-cdb6-4d96-9048-fac93813ce36,
    //      createdAt=+271952187-10-06T20:59:55.612Z,
    //      updatedAt=+14800123-06-14T17:07:53.312Z)

    System.out.println(record2);
    // -> JavaExample.Record(
    //      id=b7fe44b8-f90d-41c3-8406-9276db0a406e,
    //      createdAt=+218282276-11-01T22:34:26.961Z,
    //      updatedAt=+153555425-04-24T17:03:03.930Z)

    System.out.println(user);
    // -> JavaExample.User(
    //      name=Julieta Vallon,
    //      currentAddress=JavaExample.Address(
    //        street=Main Street,
    //        city=New York,
    //        country=Thailand),
    //      formerAddresses=[
    //        JavaExample.Address(
    //          street=Maple Street,
    //          city=New York,
    //          country=Turkmenistan)])

  }

  @Data
  public static class Record {

    private UUID id;

    private Instant createdAt;

    private Instant updatedAt;

  }

  @Value
  public static class User {

    @DummyValues(generator = NameGenerator.class)
    private final String name;

    private final Address currentAddress;

    @DummyValues(minLength = 0, maxLength = 5)
    private final List<Address> formerAddresses;
  }

  @Value
  public static class Address {

    @DummyValues({"Main Street", "Market Street", "Maple Street"})
    private final String street;

    @DummyValues({"New Amsterdam", "New Berlin", "New York"})
    private final String city;

    @DummyValues(generator = CountryNameGenerator.class)
    private final String country;
  }

}

Scala

object ScalaExample {

  def main(args: Array[String]): Unit = {
  
    val record = Dummies.get().create(classOf[Record])
    println(record)
    // -> Record(a2a64f26-ed99-4265-8b57-f668099339c7,+127329170-07-19T19:33:44.946Z,+68490793-08-27T22:13:40.674Z,CZ)

  }

  final case class Record(
    id: UUID,
    createdAt: Instant,
    updatedAt: Instant,
    @(DummyValues @field)(generator = classOf[CountryCodeGenerator])
    countryOfOrigin: String
  )

}
com.simplaex

Simplaex

The 1st party data platform that unlocks the value of your customers by turning data into insights and insights into action.

Versions

Version
1.0.0