Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.
/ random-data Public archive

A simple library that populates random Java objects and primitives.

License

Notifications You must be signed in to change notification settings

tyro/random-data

Repository files navigation

random-data

Download Build Status License

A simple library that populates random Java objects and primitives.

Support for the following types is provided:

  • Boolean, Double, Integer, Long
  • String
  • Enum
  • BigDecimal
  • LocalDate, LocalDateTime, LocalTime, Instant, YearMonth, ZonedDateTime, ZoneOffset
  • Lists and Sets of a supported type
  • Classes with constructor parameters of a supported type

Getting Started

random-data is available on Maven Central.

<dependency>
    <groupId>com.tyro.oss</groupId>
    <artifactId>random-data</artifactId>
    <version>1.0.0</version>
    <scope>test</scope>
</dependency>

Example usage.

// generate random values
val integer = randomInteger()
val long = randomLongBetween(1, 100)
val date = randomLocalDate()

// generate a random instance
val customer = random(Customer::class.java)

// generate a set of random numeric strings
val set = randomSet { randomNumericString() }

// generate a list of 10 random strings
val list = randomList({ randomString() }, 10)

Copyright and Licensing

Copyright (C) 2017 - 2021 Tyro Payments Limited

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Contributing

See CONTRIBUTING for details.

About

A simple library that populates random Java objects and primitives.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages