Model Builder

Model Builder with Random Values

License

License

GroupId

GroupId

de.7fate
ArtifactId

ArtifactId

model-builder
Last Version

Last Version

2.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

Model Builder
Model Builder with Random Values
Project URL

Project URL

https://github.com/sdfsadfasdfgsadfgsdf/model-builder.git
Project Organization

Project Organization

Mario Tema
Source Code Management

Source Code Management

https://github.com/sdfsadfasdfgsadfgsdf/model-builder

Download model-builder

How to add to project

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

Dependencies

compile (3)

Group / Artifact Type Version
commons-beanutils : commons-beanutils jar 1.9.2
commons-io : commons-io jar 2.4
org.apache.commons : commons-lang3 jar 3.4

test (4)

Group / Artifact Type Version
javax.validation : validation-api jar 1.1.0.Final
junit : junit jar 4.12
org.powermock : powermock-module-junit4 jar 1.7.1
org.powermock : powermock-api-mockito jar 1.7.1

Project Modules

There are no modules declared in this project.

model-builder

Reducing Boilerplate Code with Annotation Driven Tests

More Time for Feature functionality Through a simple set of annotations and saving 60% of development time

How to use programmatically

ModelBuilder < Person > builder = new PersonBuilder();

or on the fly

ModelBuilder < Person > builder = ModelBuilderFactory.createBuilder(Person.class);

  • create person instance within filled required properties

    • Person person = builder.min();
  • create person instance within all properties

    • Person person = builder.max();
  • create person instance within filled required or all properties

    • Person person = builder.mix();
  • create person within fix values

    • Person person = builder.fix();
  • create person from Resource

    • Person person = builder.fromResource("file://var/person.xml");
  • create a List of person instances within filled required with properties random [1..10] size

    • List< Person > persons = builder.list();
  • create a List of person instances within filled required properties with fixed size

    • List< Person > persons = builder.list(100);
  • create a Set of person instances within filled required properties with random [1..10] size

    • Set< Person > persons = builder.set();
  • create a Set of person instances within filled required properties with fixed size

    • Set< Person > persons = builder.set(100);

How to use with annotations?

  • @Model Person person; // create person instance within filled required properties
  • @Models Collection< Person > persons; // create a List of person instances with random [1..10] size

How to use with annotations but with custom builder?

  • @Resource PersonModelBuilder builder; //custom model builder
  • @Model Person person; // create person instance within filled required properties
  • @Models Collection< Person > persons; // create a List of person instances with random [1..10] size

How Annotated fields are injected?

@Before public void setUp() { FieldInjectionUtil.injectFields(this); }

Supported out of the box types

  • @Model Byte byte;
  • @Model Boolean boolean;
  • @Model Character character;
  • @Model Date date;
  • @Model BigDecimal bigDecimal;
  • @Model Double double;
  • @Model Float float;
  • @Model Integer integer;
  • @Model Long long;
  • @Model String string;
  • @Model URL url;
  • @Model Map<K, V> map;
  • @Model Enum enum;

Technology Stack

  • Java 1.8
    • Streams
    • Lambdas
  • Third Party Libraries
    • Commons-BeanUtils (Apache License)
    • Commons-IO (Apache License)
    • Commons-Lang3 (Apache License)
    • Junit (EPL 1.0 License)
  • Code-Analyses
    • Sonar
    • Jacoco

License

MIT (unless noted otherwise)

Versions

Version
2.0.0