Git Product home page Git Product logo

beanmother's People

Contributors

aelobdog avatar bhaskarmac avatar bkruczyk avatar brennengreen avatar ccoetzer avatar chandanachaitanya avatar dependabot[bot] avatar gtiwari333 avatar josejuanmontiel avatar keepcosmos avatar njchandu avatar oguzhancevik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

beanmother's Issues

How to query

This is a how to query. Apologies if this is not the right place to post queries:

book: &book
  id: ${sequence.number}
  title: ${faker.book.title}
  publishedAt: &anchor_val2 ${faker.date.between('2000-01-01', '2010-01-01')}

author:
  id: ${sequence.number}
  policies:
    id1:
      id: ${sequence.number}
      title: ${faker.book.title}
      publishedAt: *anchor_val2
    id2:
      id: ${sequence.number}
      title: ${faker.book.title}
      publishedAt: ${current.date}

Using yaml anchors here, publishedAt: *anchor_val2 generates new ${faker.date.between('2000-01-01', '2010-01-01')}

Is there a way I can reference (reuse) the data generated in publishedAt: &anchor_val2 ${faker.date.between('2000-01-01', '2010-01-01')}

build instance of an class which reference another class

in the lombok builder pattern, how to build instance of a target class which reference another class instance?

class  A {
    private String fieldA;
}

@Data
@Builder
class B {
    private String fieldB;
    private A a;
}
`

appreciate for any help~~

FakerScriptRunner is not support StringToBooleanConverter converter

Usecase

Want use randomNumber method of faker in yaml.

hoge:
  number: ${faker.number.randomNumber(12, true)}

Problem

FakerScriptRunner extends MethodReflectionEvalScriptRunner.
MethodReflectionEvalScriptRunner has ConverterFactory privately.
And ConverterFactory does not have StringToBooleanConverter (only KnownConverterModuleLoader knowns).

So, randomNumber(int, boolean) can not be resolved.

Query

  1. Is it possible to create a bean object for an object which is not at the root level?
    Ex:
my:
  book: &book
    id: ${sequence.number}
    title: ${faker.book.title}
    language: en
    publishedAt: ${faker.date.between('2000-01-01', '2010-01-01')}

  author:
    id: ${sequence.number}
    works:
      - <<: *book
      - <<: *book
      - <<: *book
    somethingElse: bla
  1. Is it possible to create a bean for a specific object in a specific file if there are duplicate yaml objects.
    Ex:
first.yml
book: &book
  id: 1
  title: ${faker.book.title}
  language: en
  publishedAt: ${faker.date.between('2000-01-01', '2010-01-01')}

and

second.yml
book: &book
  id: 2
  title: ${faker.book.title}
  language: en
  publishedAt: ${faker.date.between('2000-01-01', '2010-01-01')}

Script inside _construct not working

I'm using this with Kotlin data classes, they don't have default constructors. Since I can use _construct this shouldn't be a problem. However, when trying to create a class with a script ${sequence.number}, Beanmother gives an exception that my class doesn't have a default constructor.

This works:

valid_account:
  _construct:
    - 1 # Int
    - Roxo # String
    - 'BRL 0.00' # BigMoney

This doesn't:

valid_account:
  _construct:
    - ${sequence.number} # Int
    - Roxo # String
    - 'BRL 0.00' # BigMoney

Is this the correct behavior? Shouldn't scripts work anywhere?

Info question

Excellent tool again. I am using this for test data in a test project. Is there a way to read the values of the yaml file to a map of objects. Something like, map<Object, Object>?

Because the test data can grow over time and the structure will never get complex. So, it can get to a max of 2 or 3 levels in hierarchy. I am open to suggestions if this approach doesn't make sense. Please recommend what makes sense.

Thanks.

Shared reference between beans?

Hi!

I want to try this library for testing, but the immediate problem I've run into is that I can't re-use an instance. Essentially I want to do this:

pizza: &pizza
  ingredients:
    - ham
    - cheese
    - pineapple
  name: hawaiian

mario: &mario
  name: Mario
  lunch: *pizza
  dinner: *pizza
  breakfast: *pizza

Except I want a single instance of Pizza. Eg so that mario.lunch == mario.dinner instead of just mario.lunch.equals(mario.dinner)

Is there a built in way I can do this?

Doesn't support Set

If target object has field of type Set, following exception is thrown

io.beanmother.core.mapper.FixtureMappingException: Target setter of 'name-of-the-property' must be List or array.

this method only checks for arrays or lists, because of that having custom converter doesn't resolve the problem.

Is it possible to use Pair object to translate the yml data

author:
  id: ${sequence.number}
  policies:
    id2:
      id: ${sequence.number}
      title: ${faker.book.title}
      pubInfo:
        publishedAt: ${current.date}
        publishedAt: ${faker.date.between('2020-01-01', '2030-01-01')}

Is it possible to translate it to

private Pair<String, Book> policies;

I'm able to read it into a map though.

private Map<String, Book> policies;

Thanks in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.