• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Fairy类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中io.codearte.jfairy.Fairy的典型用法代码示例。如果您正苦于以下问题:Java Fairy类的具体用法?Java Fairy怎么用?Java Fairy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Fairy类属于io.codearte.jfairy包,在下文中一共展示了Fairy类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: buildFairy

import io.codearte.jfairy.Fairy; //导入依赖的package包/类
private Fairy buildFairy(AnnotatedElement annotatedElement) {
  Random random = findAnnotation(annotatedElement, Random.class).get();
  Builder builder = Fairy.builder();

  String locale = random.locale();
  if (!Random.DEFAULT_LOCALE.equals(locale)) {
    builder.withLocale(Locale.forLanguageTag(locale));
  }

  int seed = random.seed();
  if (Random.DEFAULT_SEED != seed) {
    builder.withRandomSeed(seed);
  }

  return builder.build();
}
 
开发者ID:rweisleder,项目名称:jfairy-junit-extension,代码行数:17,代码来源:ObjectProvider.java


示例2: generateStories

import io.codearte.jfairy.Fairy; //导入依赖的package包/类
public static List<Story> generateStories(){
    Fairy fairy = Fairy.create();
    BaseProducer baseProducer = fairy.baseProducer();
    List<Story> stories = new ArrayList<>();

    for(int i=0; i<=baseProducer.randomBetween(1, 50); i++){
        stories.add(generateStory());
    }

    return stories;
}
 
开发者ID:nicolasmanic,项目名称:Facegram,代码行数:12,代码来源:FakeDataGenerator.java


示例3: generateStory

import io.codearte.jfairy.Fairy; //导入依赖的package包/类
public static Story generateStory(){
    Fairy fairy = Fairy.create();
    TextProducer textProducer = fairy.textProducer();
    BaseProducer baseProducer = fairy.baseProducer();
    Story story = new Story.Builder()
            .title(textProducer.sentence())
            .userId(String.valueOf(baseProducer.randomBetween(0, 999999999)))
            .geolocation(getRandomGeoLocation())
            .groupId(null)
            .id(String.valueOf(baseProducer.randomBetween(0, 999999999)))
            .story(textProducer.paragraph())
            .build();

    return story;
}
 
开发者ID:nicolasmanic,项目名称:Facegram,代码行数:16,代码来源:FakeDataGenerator.java


示例4: generateStoryWithoutId

import io.codearte.jfairy.Fairy; //导入依赖的package包/类
public static Story generateStoryWithoutId(){
    Fairy fairy = Fairy.create();
    TextProducer textProducer = fairy.textProducer();
    BaseProducer baseProducer = fairy.baseProducer();

    Story story = new Story.Builder()
            .title(textProducer.sentence())
            .userId(String.valueOf(baseProducer.randomBetween(0, 999999999)))
            .geolocation(getRandomGeoLocation())
            .groupId(null)
            .story(textProducer.paragraph())
            .build();

    return story;
}
 
开发者ID:nicolasmanic,项目名称:Facegram,代码行数:16,代码来源:FakeDataGenerator.java


示例5: generateComments

import io.codearte.jfairy.Fairy; //导入依赖的package包/类
public static List<Comment> generateComments() {
    Fairy fairy = Fairy.create();
    BaseProducer baseProducer = fairy.baseProducer();
    List<Comment> comments = new ArrayList<>();

    for(int i=0; i<=baseProducer.randomBetween(2, 10); i++){
        comments.add(generateComment());
    }

    return comments;
}
 
开发者ID:nicolasmanic,项目名称:Facegram,代码行数:12,代码来源:FakeDataGenerator.java


示例6: generateComment

import io.codearte.jfairy.Fairy; //导入依赖的package包/类
public static Comment generateComment() {
    Fairy fairy = Fairy.create();
    TextProducer textProducer = fairy.textProducer();
    BaseProducer baseProducer = fairy.baseProducer();

    Comment comment = new Comment.Builder()
            .storyId(String.valueOf(baseProducer.randomBetween(0, 999999999)))
            .description(textProducer.paragraph(10))
            .userId(String.valueOf(baseProducer.randomBetween(0, 999999999)))
            .header(textProducer.sentence())
            .id(String.valueOf(baseProducer.randomBetween(0, 999999999)))
            .build();

    return comment;
}
 
开发者ID:nicolasmanic,项目名称:Facegram,代码行数:16,代码来源:FakeDataGenerator.java


示例7: generateStoryRequest

import io.codearte.jfairy.Fairy; //导入依赖的package包/类
public static StoryRequest generateStoryRequest() {
    Fairy fairy = Fairy.create();
    TextProducer textProducer = fairy.textProducer();

    return new StoryRequest(textProducer.paragraph(),textProducer.sentence(),null, getRandomGeoLocation());
}
 
开发者ID:nicolasmanic,项目名称:Facegram,代码行数:7,代码来源:FakeDataGenerator.java


示例8: generateStories

import io.codearte.jfairy.Fairy; //导入依赖的package包/类
public static List<Story> generateStories() {
    Fairy fairy = Fairy.create();
    BaseProducer baseProducer = fairy.baseProducer();
    List<Story> stories = new ArrayList<>();
    for (int i = 0; i <= baseProducer.randomBetween(1, 50); i++) {
        stories.add(generateStory());
    }
    return stories;
}
 
开发者ID:nicolasmanic,项目名称:Facegram,代码行数:10,代码来源:FakeDataGenerator.java


示例9: randomIds

import io.codearte.jfairy.Fairy; //导入依赖的package包/类
private static List<String> randomIds() {
    Fairy fairy = Fairy.create();
    BaseProducer baseProducer = fairy.baseProducer();
    ArrayList<String> tempList = new ArrayList<>();
    tempList.add(String.valueOf(baseProducer.randomBetween(1, 999999999)));
    tempList.add(String.valueOf(baseProducer.randomBetween(1, 999999999)));
    return tempList;
}
 
开发者ID:nicolasmanic,项目名称:Facegram,代码行数:9,代码来源:FakeDataGenerator.java


示例10: generateStory

import io.codearte.jfairy.Fairy; //导入依赖的package包/类
public static Story generateStory() {
    Fairy fairy = Fairy.create();
    TextProducer textProducer = fairy.textProducer();
    BaseProducer baseProducer = fairy.baseProducer();
    Story story = new Story.Builder<>()
            .title(textProducer.sentence())
            .userId(String.valueOf(baseProducer.randomBetween(0, 999999999)))
            .geolocation(generateRandomGeolocation())
            .id(String.valueOf(baseProducer.randomBetween(0, 999999999)))
            .story(textProducer.paragraph())
            .build();
    return story;
}
 
开发者ID:nicolasmanic,项目名称:Facegram,代码行数:14,代码来源:FakeDataGenerator.java


示例11: generateStories

import io.codearte.jfairy.Fairy; //导入依赖的package包/类
public static List<Story> generateStories(){
    Fairy fairy = Fairy.create();
    BaseProducer baseProducer = fairy.baseProducer();
    List<Story> stories = new ArrayList<>();
    for(int i=0; i<=baseProducer.randomBetween(1, 50); i++){
        stories.add(generateStory());
    }
    return stories;
}
 
开发者ID:nicolasmanic,项目名称:Facegram,代码行数:10,代码来源:FakeDataGenerator.java


示例12: generateUser

import io.codearte.jfairy.Fairy; //导入依赖的package包/类
public static User generateUser(){
    Fairy fairy = Fairy.create();
    Person person = fairy.person();
    BaseProducer baseProducer = fairy.baseProducer();
    User user = new User.Builder()
            .gender(Gender.MALE)
            .username(String.valueOf(baseProducer.randomBetween(1, 999999999)))
            .name(person.getFirstName())
            .surname(person.getLastName())
            .build();
    return user;
}
 
开发者ID:nicolasmanic,项目名称:Facegram,代码行数:13,代码来源:FakeDataGenerator.java


示例13: randomIds

import io.codearte.jfairy.Fairy; //导入依赖的package包/类
private static List<String> randomIds(){
    Fairy fairy = Fairy.create();
    BaseProducer baseProducer = fairy.baseProducer();
    ArrayList<String> tempList = new ArrayList<>();
    tempList.add(String.valueOf(baseProducer.randomBetween(1, 999999999)));
    tempList.add(String.valueOf(baseProducer.randomBetween(1, 999999999)));
    return tempList;
}
 
开发者ID:nicolasmanic,项目名称:Facegram,代码行数:9,代码来源:FakeDataGenerator.java


示例14: generateUsers

import io.codearte.jfairy.Fairy; //导入依赖的package包/类
public static List<User> generateUsers(){
    Fairy fairy = Fairy.create();
    BaseProducer baseProducer = fairy.baseProducer();
    List<User> users = new ArrayList<>();
    for(int i=0; i<=baseProducer.randomBetween(2, 10); i++){
        users.add(generateUser());
    }
    return users;
}
 
开发者ID:nicolasmanic,项目名称:Facegram,代码行数:10,代码来源:FakeDataGenerator.java


示例15: generateStory

import io.codearte.jfairy.Fairy; //导入依赖的package包/类
public static Story generateStory(){
    Fairy fairy = Fairy.create();
    TextProducer textProducer = fairy.textProducer();
    BaseProducer baseProducer = fairy.baseProducer();
    Story story = new Story.Builder()
            .title(textProducer.sentence())
            .userId(String.valueOf(baseProducer.randomBetween(0, 999999999)))
            .geolocation(generateRandomGeolocation())
            .id(String.valueOf(baseProducer.randomBetween(0, 999999999)))
            .story(textProducer.paragraph())
            .build();
    return story;
}
 
开发者ID:nicolasmanic,项目名称:Facegram,代码行数:14,代码来源:FakeDataGenerator.java


示例16: createFor

import io.codearte.jfairy.Fairy; //导入依赖的package包/类
@Override
Object createFor(AnnotatedElement annotatedElement, Class<?> targetType, Fairy fairy) {
  StringWith config = findAnnotation(annotatedElement, StringWith.class).orElse(null);
  int maxLength = maxLength(config);
  StringType type = type(config);

  TextProducer producer = fairy.textProducer().limitedTo(maxLength);
  return providers.get(type).produce(producer, maxLength);
}
 
开发者ID:rweisleder,项目名称:jfairy-junit-extension,代码行数:10,代码来源:StringProvider.java


示例17: createFor

import io.codearte.jfairy.Fairy; //导入依赖的package包/类
@Override
Object createFor(AnnotatedElement annotatedElement, Class<?> targetType, Fairy fairy) {
  IntegerWith config = findAnnotation(annotatedElement, IntegerWith.class).orElse(null);
  int min = minValue(config);
  int max = maxValue(config);

  BaseProducer producer = fairy.baseProducer();
  return producer.randomBetween(min, max);
}
 
开发者ID:rweisleder,项目名称:jfairy-junit-extension,代码行数:10,代码来源:IntegerProvider.java


示例18: createFor

import io.codearte.jfairy.Fairy; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
Object createFor(AnnotatedElement annotatedElement, Class<?> targetType, Fairy fairy) {
  Class<Enum<?>> enumClass = (Class<Enum<?>>) targetType;

  BaseProducer producer = fairy.baseProducer();
  return producer.randomElement(enumClass);
}
 
开发者ID:rweisleder,项目名称:jfairy-junit-extension,代码行数:9,代码来源:EnumProvider.java


示例19: generate

import io.codearte.jfairy.Fairy; //导入依赖的package包/类
public void generate(final int n) throws IOException, TException {
    for (int i = 0; i < n; ++i) {
        Fairy fairy = LOCAL_FAIRIES[new Random().nextInt(LOCAL_FAIRIES.length)];
        generator.setFairy(fairy);

        PM providence = generator.generate(descriptor);
        TM thrift = convert(providence);

        pvdListBuilder.add(providence);
        thrListBuilder.add(thrift);
    }
}
 
开发者ID:morimekta,项目名称:providence,代码行数:13,代码来源:ITGenerator.java


示例20: GeneratorBase

import io.codearte.jfairy.Fairy; //导入依赖的package包/类
private GeneratorBase(Map<PMessageDescriptor, MessageGenerator> defaultMessageGenerators,
                      Map<PEnumDescriptor, Generator> defaultEnumGenerators,
                      double defaultFillRate,
                      int defaultMaxCollectionSize,
                      Fairy fairy,
                      Random random) {
    this.fairy = fairy;
    this.random = random;
    this.primitiveCache = new EnumMap<>(PType.class);

    this.defaultFillRate = defaultFillRate;
    this.defaultMaxCollectionSize = defaultMaxCollectionSize;
    this.defaultMessageGenerators = defaultMessageGenerators;
    this.defaultEnumGenerators = defaultEnumGenerators;
}
 
开发者ID:morimekta,项目名称:providence,代码行数:16,代码来源:GeneratorBase.java



注:本文中的io.codearte.jfairy.Fairy类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Objects类代码示例发布时间:2022-05-22
下一篇:
Java HttpResponse类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap