add 2 methods to Generex: generateMaxLength + generateMinLength#37
Open
astik wants to merge 2 commits into
Open
add 2 methods to Generex: generateMaxLength + generateMinLength#37astik wants to merge 2 commits into
astik wants to merge 2 commits into
Conversation
Author
|
In the meantime, here is a workaround : private Automaton getAutomaton() {
// this method is necessary as Generex does not expose automaton.
// as soon as it will (if it will), this method should be remove
// see https://github.com/mifmif/Generex/pull/37
try {
return (Automaton) FieldUtils.readField(generex, "automaton", true);
} catch (IllegalAccessException e) {
throw new TechnicalException("Failure to access private attribute automaton from generex instance", e);
}
}This allow me to access the automaton instance from the generex one. |
Owner
|
Could you please provide a description with some examples that shows when to use the exposed Automaton and the two additional methods (min/max). Test cases are also required to validate the implementation of those methods. Thanks. |
Author
|
I added the unit test for min and max length expectations. Here is a use case we have currently with Generex :
For this particular validation need, we need to access those 2 status from automaton. |
330a7c7 to
9945af9
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automaton is not exposed though Generex.
This is a not cool because it exposes some useful methods for information.
Those changes expose 2 methods to get sizes for the shortest and longest string that can be generated (which can be useful if you need to define regexp that produce string with a constraint length)