fixture-monkey
fixture-monkey copied to clipboard
Apply size methods to String
Describe the feature you request
giveMeBuilder#size methods not applied to String class.
For example, folowing code produces arbitrary size of string.
data class A(val a: String)
val value = fixtureMonkey.giveMeBuilder<A>()
.size(A::a, 10)
.sample()
println(value.a.length)
(Optional): Suggest A Solution
If would be nice to produce string with the size i provided.
If the feature request is approved, would you be willing to submit a PR?
Yes
I think this is a good feature to keep consistency with the @Size annotation.
@Target(value={METHOD,FIELD,ANNOTATION_TYPE,CONSTRUCTOR,PARAMETER})
@Retention(value=RUNTIME)
@Documented
@Constraint(validatedBy={})
public @interface Size
The annotated element size must be between the specified boundaries (included).
Supported types are:
CharSequence (length of character sequence is evaluated)
Collection (collection size is evaluated)
Map (map size is evaluated)
Array (array length is evaluated)
null elements are considered valid.
It would be nice to work on the CharSequence interface if we go further.