• Stars
    star
    527
  • Rank 84,091 (Top 2 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created almost 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

MockNeat - the modern faker lib.

Mockneat Maven Central Build Status codecov is an arbitrary data-generator open-source library written in Java.

It provides a simple but powerful (fluent) API that enables developers to create json, xml, csv and sql data programatically.

It can also act as a powerful Random substitute or a mocking library.

Official Documentation: www.mockneat.com

Official Tutorial: www.mockneat.com

If you want to use mockneat to mock REST APIs checkout my other project: serverneat.

Installing

>= 0.4.4

Maven:

<dependency>
  <groupId>net.andreinc</groupId>
  <artifactId>mockneat</artifactId>
  <version>0.4.8</version>
</dependency>

Gradle:

implementation 'net.andreinc:mockneat:0.4.8'

<= 0.4.2

Maven:

<repositories>
    <repository>
        <id>jcenter</id>
        <url>https://jcenter.bintray.com/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>net.andreinc.mockneat</groupId>
        <artifactId>mockneat</artifactId>
        <version>0.4.2</version>
    </dependency>
</dependencies>

Gradle:

repositories {
  jcenter()
}
dependencies {
  compile 'net.andreinc.mockneat:mockneat:0.4.2'
}

Example - A random dice roll

List<String> somePeople = names().full().list(10).get();

fmt("#{person} rolled: #{roll1} #{roll2}")
            .param("person", seq(somePeople))
            .param("roll1", ints().rangeClosed(1, 6))
            .param("roll2", ints().rangeClosed(1, 6))
            .accumulate(10, "\n")
            .consume(System.out::println);

System.out.println("\nWho wins ?\n");

(possible) Output:

Sal Clouden rolled: 3 3
Cinthia Myrum rolled: 1 5
Wyatt Imber rolled: 5 1
Fidel Quist rolled: 2 2
Brandon Scrape rolled: 6 4
Arlene Cesare rolled: 6 4
Brandie Sumsion rolled: 3 4
Norris Tunby rolled: 3 5
Kareem Willoughby rolled: 1 5
Zoraida Finnerty rolled: 1 6

Who wins ?

Example - A simple CSV

System.out.println("First Name, Last Name, Email, Site, IP, Credit Card, Date");

csvs()
  .column(names().first())
  .column(names().last())
  .column(emails().domain("mockneat.com"))
  .column(urls().domains(POPULAR))
  .column(ipv4s().types(CLASS_B, CLASS_C_NONPRIVATE))
  .column(creditCards().types(AMERICAN_EXPRESS, VISA_16))
  .column(localDates().thisYear())
  .separator(" ; ")
  .accumulate(25, "\n")
  .consume(System.out::println);

(possible) Output:

Lorrie ; Urquilla ; [email protected] ; http://www.sugaredherlinda.com ; 172.150.99.65 ; 4991053014393849 ; 2019-05-25
Tabitha ; Copsey ; [email protected] ; http://www.arightcarnify.io ; 166.192.196.15 ; 4143903215740668 ; 2019-07-13
Laurine ; Patrylak ; [email protected] ; http://www.ninthbanc.gov ; 187.28.250.76 ; 4450754596171263 ; 2019-09-10
Starla ; Peiper ; [email protected] ; http://www.eathlessen.edu ; 202.189.115.252 ; 4470988734574428 ; 2019-02-18
Lakiesha ; Zevenbergen ; [email protected] ; http://www.unbendingeyes.edu ; 204.112.195.47 ; 4040555724781858 ; 2019-11-12

... and so on

Special thanks to the contributors:

More Repositories

1

lc3-vm

A LC3 virtual machine implementation in a few lines of C code
C
352
star
2

java-bean-validation-extension

A library that extends the Java Bean Validation with additional @Annotations.
Java
122
star
3

neat-matrix-library

nml is a "simple" matrix/numerical analysis library written in pure C. The scope of the library is to highlight various algorithm implementations related to matrices. Code readability was a major concern.
C
87
star
4

hr-schema-mysql

DML and DDL scripts to generate the HR SQL Schema for MySQL
74
star
5

mapneat

MapNeat is a JVM library written in Kotlin that provides an easy to use DSL (Domain Specific Language) for transforming JSON to JSON, XML to JSON, POJO to JSON in a declarative way.
Kotlin
62
star
6

java-interview-questions

Java interview questions
57
star
7

neat-chess

Java UCI Protocol implementation (Universal Chess Engine)
Java
34
star
8

microblog-c

C
25
star
9

serverneat

A Kotlin DSL for creating mock servers - using MockNeat for generating data
Kotlin
21
star
10

integers-snake

C
19
star
11

aleph-formatter

A simple and efficient StringFormatter that supports named parameters (with a twist)
Java
19
star
12

ansiscape

Color your output using Ansi Escape codes
Java
16
star
13

neat-sample-databases-generators

Neat java scripts (!not javascript) to generate arbitrary data for various sample databases (hr schema, classicmodels, etc.)
Java
15
star
14

chained-hash-table-c

A chained hash table implemented in C
C
15
star
15

c-generic-pqueue

A generic Priority Queue implementation in C using heaps - nothing fancy.
C
12
star
16

andreinc-site

My personal blog
JavaScript
10
star
17

spring-boot-jwt-example

A Spring Boot example application that uses JWT tokens and @WebFilter for securing resources access.
Java
9
star
18

jasuggest

A simple autosuggest library based on a Java Trie implementation.
Java
9
star
19

carsandpolice

A streaming example using Kafka/KSQLDB.
Java
7
star
20

open-adressing-hash-table-c

C
7
star
21

cpp-interview-questions

C++ interview questions
7
star
22

bloomfilters-c

Bloom filters in C
C
7
star
23

open-addressing-java-maps

Some custom maps implemented in Java to experiment various algorithms
Java
6
star
24

nmlib

A generic C data structures library I've created 10 years ago, to help me with various university homeworks. Found it in the google code archive (the github of that time).
C
5
star
25

tutorial-java8-streams-lambdas

Java 8 tutorial streams and lambdas
Java
5
star
26

blog-generic-data-structures-in-c

Academic implementation of a Generic Stack data-structure in C (using macro concatenation and void pointers)
C
4
star
27

uci-protocol-specification

2
star
28

micronaut-crud-backend

A CRUD application using Micronaut
Java
2
star
29

elasticpoc

Elastic POC
Java
2
star
30

haskell-exercises

Solutions for the 99 Haskell Problems
Haskell
2
star
31

spring-boot-jbvext-example

A sample Rest API that is validated using Java Bean Validation Extensions and JSR-380
Java
2
star
32

pysert

A python script that can be used to generate arbitrarily data. Initially written the script around 2012, found it in the google code archives.
Python
2
star
33

mapneat-examples

MapNeat Examples
Kotlin
2
star
34

blog-java-shunting-yard

An academic implenentation for the Shunting Yard Algorithm in Java
Java
1
star
35

mycv

my cv
1
star
36

nomemory

1
star
37

commercetools-enricher

Java
1
star
38

golang-exercises

Doing some exercises for learning golang
Go
1
star
39

mphmap

Java
1
star
40

markovneat

Markov chains in Java
Java
1
star
41

mockneat-site

Mockneat Jekyll Site
Ruby
1
star
42

blog-gzip-stream-serialization

Serialize / Unserialize objects using Zip Streams
Java
1
star
43

blog-stein-algorithm-c

An "academic" implementation in C for the stein algorithm
C
1
star
44

KT-43176-kotlin-bug

Kotlin
1
star