-
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
154 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
plugins { | ||
`faker-lib-conventions` | ||
`faker-provider-conventions` | ||
} |
6 changes: 2 additions & 4 deletions
6
...hub/serpro69/kfaker/provider/CompanyIT.kt → ...o69/kfaker/commerce/provider/CompanyIT.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
...hub/serpro69/kfaker/provider/FinanceIT.kt → ...o69/kfaker/commerce/provider/FinanceIT.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
provider/commerce/src/main/kotlin/io/github/serpro69/kfaker/commerce/CommerceFaker.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package io.github.serpro69.kfaker.commerce | ||
|
||
import io.github.serpro69.kfaker.AbstractFaker | ||
import io.github.serpro69.kfaker.FakerConfig | ||
import io.github.serpro69.kfaker.FakerDsl | ||
import io.github.serpro69.kfaker.commerce.provider.Bank | ||
import io.github.serpro69.kfaker.commerce.provider.Barcode | ||
import io.github.serpro69.kfaker.commerce.provider.Beer | ||
import io.github.serpro69.kfaker.commerce.provider.Business | ||
import io.github.serpro69.kfaker.commerce.provider.Cannabis | ||
import io.github.serpro69.kfaker.commerce.provider.Coffee | ||
import io.github.serpro69.kfaker.commerce.provider.Commerce | ||
import io.github.serpro69.kfaker.commerce.provider.Company | ||
import io.github.serpro69.kfaker.commerce.provider.Construction | ||
import io.github.serpro69.kfaker.commerce.provider.Finance | ||
import io.github.serpro69.kfaker.commerce.provider.Food | ||
import io.github.serpro69.kfaker.commerce.provider.IndustrySegments | ||
import io.github.serpro69.kfaker.commerce.provider.Marketing | ||
import io.github.serpro69.kfaker.provider.Money | ||
import io.github.serpro69.kfaker.commerce.provider.Restaurant | ||
import io.github.serpro69.kfaker.commerce.provider.Subscription | ||
import io.github.serpro69.kfaker.commerce.provider.Tea | ||
import io.github.serpro69.kfaker.fakerConfig | ||
|
||
/** | ||
* Typealias for the [CommerceFaker] | ||
*/ | ||
typealias Faker = CommerceFaker | ||
|
||
/** | ||
* Provides access to fake data generators withing the Books domain. | ||
* | ||
* Each category (generator) from this [CommerceFaker] is represented by a property that has the same name as the `.yml` file. | ||
* | ||
* @property unique global provider for generation of unique values. | ||
*/ | ||
@Suppress("unused") | ||
class CommerceFaker @JvmOverloads constructor(config: FakerConfig = fakerConfig { }) : AbstractFaker(config) { | ||
|
||
val bank: Bank by lazy { Bank(fakerService) } | ||
val barcode: Barcode by lazy { Barcode(fakerService) } | ||
val beer: Beer by lazy { Beer(fakerService) } | ||
val business: Business by lazy { Business(fakerService) } | ||
val cannabis: Cannabis by lazy { Cannabis(fakerService) } | ||
val coffee: Coffee by lazy { Coffee(fakerService) } | ||
val commerce: Commerce by lazy { Commerce(fakerService) } | ||
val company: Company by lazy { Company(fakerService) } | ||
val construction: Construction by lazy { Construction(fakerService) } | ||
val finance: Finance by lazy { Finance(fakerService, randomService) } | ||
val food: Food by lazy { Food(fakerService) } | ||
val industrySegments: IndustrySegments by lazy { IndustrySegments(fakerService) } | ||
// TODO not implemented | ||
// val invoice: Invoice by lazy { Invoice(fakerService } | ||
val marketing: Marketing by lazy { Marketing(fakerService) } | ||
val restaurant: Restaurant by lazy { Restaurant(fakerService) } | ||
val subscription: Subscription by lazy { Subscription(fakerService) } | ||
val tea: Tea by lazy { Tea(fakerService) } | ||
|
||
@FakerDsl | ||
/** | ||
* DSL builder for creating instances of [Faker] | ||
*/ | ||
class Builder internal constructor() : AbstractFaker.Builder<Faker>() { | ||
|
||
/** | ||
* Builds an instance of [Faker] with this [config]. | ||
*/ | ||
override fun build(): Faker = Faker(config) | ||
} | ||
} | ||
|
||
/** | ||
* Applies the [block] function to [CommerceFaker.Builder] | ||
* and returns as an instance of [CommerceFaker] from that builder. | ||
*/ | ||
fun faker(block: CommerceFaker.Builder.() -> Unit): CommerceFaker = CommerceFaker.Builder().apply(block).build() |
Oops, something went wrong.