티스토리 뷰

Programming/Test

Random Beans

Albothyl 2019. 8. 30. 13:53
  1. Dependency
    1. maven repository: https://mvnrepository.com/artifact/io.github.benas/random-beans
  2. 기능
    1. 객체나 콜렉션의 값을 random하게 채워서 반환한다.
    2. 테스트 데이터를 만들기 위해서 개발자가 모든 필드에 값을 채울 필요가 없다.
    3. 테스트에 꼭 필요한 필드만 값을 넣지 않고, 개발자가 직접 설정할 수 있다.
  3. 사용법
    1. Random Object
      1. public static  T random(final Class type, final String... excludedFields)
      2. example: SomeObject someObject = EnhancedRandom.random(SomeObject.class)
    2. Random Collection
      1. public static  Collection randomCollectionOf(final int amount, final Class type, final String... excludedFields)
      2. example: Collection someObjectCollection = EnhancedRandom.randomCollectionOf(10, SomeObject.class)
    3. Random List
      1. public static  List randomListOf(final int amount, final Class type, final String... excludedFields)
      2. example: List someObjectList = EnhancedRandom.randomListOf(10, SomeObject.class)
    4. Random Set
      1. public static  Set randomSetOf(final int amount, final Class type, final String... excludedFields) 
      2. example: Set someObjectSet = EnhancedRandom.randomSetOf(10, SomeObject.class)

'Programming > Test' 카테고리의 다른 글

Spock  (0) 2018.12.27
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함