Closed php-coder closed 5 years ago
The reason it was done with an abstract class is because the core lib is compiled and can be used with Java5+. We could drop support for Java5, but there should be at least some justification.
The idea behind a library like Datagen is that you don't clutter your test with low-level logic. Giving an ability to provide a lambda violates this principle. Moreover it's not an action that you want to pass - it's a result that you want to state, so lambdas barely suit here anyway. Instead of length(10).with((s) -> s.doSomeModifications()).english(10)
you could write length(10).with(someModifications()).english(10)
and make it more readable.
I recognize that this is not a strong argument, but I think arguments for both sides are pretty weak. So all in all I'm inclined to keep it as is for now.
Ok, no problem. It was just an idea.
Do you support this library by the way?
I have plans to introduce changes (that you asked in other requests), add features. But right now I don't have enough time - maybe in 6 months things will change.
StringModifier
can be turned into functional interface.In order to do that, we should move implementation of
modify(List<String>)
method fromWithDefaultBatchModify
class intoStringModifier
and mark it as a default method.