Releases: easymodeling/easy-modeling
0.1.4
New Features
Method stream won't return an infinite stream
Static method stream of Modelers will return a limited stream of items instead of infinite one.
Now we have two overloads of stream methods:
var streamFoo = XXXModeler.stream();
// streamFoo will yield a limited random number of items
var streamBar = XXXModeler.stream(5);
// streamBar will yield 5 itemsBug Fix
Tolerate constructor exceptions
EasyModeling will search for available constructors to create instances.
When one constructor throws during constructing instance,
EasyModeling will fall back to the next available one.
When all available constructors threw,
EasyModeling will stop creating instances of the specific class.
Inner classes will not cause errors
EasyModeling will ignore the generation of modelers for inner classes.
However, inner classes will still not be supported.
I'm still working on supporting inner classes.
0.1.3
New Feature
Create collections from modelers
Now we support creating Stream and List of models from models directly:
List<XXX> list = XXXModeler.list();
List<XXX> listWith3Item = XXXModeler.list(3);
Stream<XXX> stream = XXXModeler.stream(); // will be infiniteMore types supported
Support randomly populating more types of fields, including:
BigDecimalBigInteger
0.1.2
New Feature
Start to support the population for inherited fields of derived classes. (#3)
Demonstration
Assume we have Base and Derived classes like below:
class Base {
public int baseInt;
public String name; // hidden field
public Instant time; // hidden field
}
class Derived {
public int derivedInt;
public long derivedLong;
public String name; // hides base class field
public Date time; // hides base class field
}When we create instances of the Derived class with DerivedModeler , it will populate all the fields declared in Base and Derived classes, including hidden fields like Base#name and Base#time.
@Modeler(type = Derived.class) class ModelHelper {}
Derived o = DerivedModeler.next();
assert o.baseInt != null;
assert ((Base) o).name != null;
assert ((Base) o).time != null;
assert o.derivedInt != null;
assert o.derivedLong != null;
assert ((Derived) o).name != null;
assert ((Derived) o).time != null;Hidden fields are not supported by generated Builders
Please note that the hidden fields could not be customized via the builder provided by easymodeling, for example:
Derived o = DerivedModeler.builder().name("some name").time(Instant.EPOCH).build();
assert ((Base) o).name != "some name";
assert ((Derived) o).name == "some name";
assert ((Base) o).time != Instant.EPOCH;
assert ((Derived) o).time == Instant.EPOCH;0.1.0
Finally we have the version 0.1.0
No changes since the pre-version 0.1.0-Beta.
0.1.0-Beta
This is the second pre-release before v0.1.0, and it comes with the following feature changes and bug fixes:
Feature Changes
- Do not support the
minSizeattribute for fieldsSet,Map, and their derived types
Since Set and Map types implicitly require their elements or keys to be unique to each other, EasyModeling cannot guarantee that more than minSize of elements could be generated with given criteria, which will make the test run indefinitely. So I decided to no longer support any user-specified minSize for these types.
However, EasyModeling will still try its best to ensure fields of related types have at least one element.
Bug Fix
- ISSUE #1: Circular referenced types will take forever to be populated
Thanks a lot to @engtecmat for bringing up this issue!
0.1.0-Alpha1
First Pre-release
As a newborn library, there are still some enhancements to be finished to cover some corner usages, and there must be lots of defects and even bugs to be found. However, at this point, I decided to make a pre-release to let the library go live earlier so that it could be verified by real-life projects rather than only integration tests.
Happy Birthday 🎂
This release, as the first release, is also a gift to myself for the 31st birthday 🎂🎈