Last active
December 18, 2015 22:39
-
-
Save diego-aslz/5855760 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package factj.test; | |
import factj.FactJ; | |
public class Application { | |
public static void main(String[] args) { | |
PersonFabricator.load(); | |
System.out.println(FactJ.build(Person.class)); | |
System.out.println(FactJ.build(Person.class)); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Person [id=1, name=Diego, [email protected]] | |
Person [id=2, name=Diego, [email protected]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package factj.test; | |
import static factj.DSL.field; | |
import static factj.DSL.sequence; | |
import factj.Fabricator; | |
import factj.decorators.SequenceDecorator.Sequence; | |
public abstract class PersonFabricator extends Fabricator { | |
static { | |
Sequence emailSequence = new Sequence() { | |
@Override | |
public Object generate(int count) { | |
return "user" + count + "@company.com"; | |
} | |
}; | |
fabricate(Person.class, | |
sequence("id"), | |
field("name", "Diego"), | |
sequence("email", emailSequence)); | |
} | |
public static void load() { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment