Package br.com.six2six.template

Source Code of br.com.six2six.template.FixtureCircularTemplate

package br.com.six2six.template;

import br.com.six2six.fixturefactory.Fixture;
import br.com.six2six.fixturefactory.Rule;
import br.com.six2six.fixturefactory.loader.TemplateLoader;
import br.com.six2six.fixturefactory.model.Item;
import br.com.six2six.fixturefactory.model.Order;
import br.com.six2six.fixturefactory.model.Payment;

public class FixtureCircularTemplate implements TemplateLoader {

  @Override
  public void load() {
    Fixture.of(Order.class).addTemplate("valid", new Rule(){{
      add("id", random(Long.class, range(1L, 200L)));
      add("items", has(3).of(Item.class, "valid"));
      add("payment", one(Payment.class, "valid"));
    }});

    Fixture.of(Order.class).addTemplate("otherValid", new Rule(){{
      add("id", random(Long.class, range(1L, 200L)));
      add("items", has(3).of(Item.class, "valid").targetAttribute("order"));
      add("payment", one(Payment.class, "valid").targetAttribute("order"));
    }});
   
    Fixture.of(Item.class).addTemplate("valid", new Rule(){{
      add("productId", random(Integer.class, range(1L, 200L)));
    }});

    Fixture.of(Payment.class).addTemplate("valid", new Rule(){{
      add("id", random(Long.class, range(1L, 200L)));
    }});
  }
}
TOP

Related Classes of br.com.six2six.template.FixtureCircularTemplate

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.