Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protobuf randomizer not using custom randomizers #33

Open
carborgar opened this issue Jun 2, 2023 · 0 comments
Open

Protobuf randomizer not using custom randomizers #33

carborgar opened this issue Jun 2, 2023 · 0 comments

Comments

@carborgar
Copy link
Collaborator

hi,
I just noticed that protobuf field predicates are not working when specifying custom random values providers.

For example, the following test fails

    void shouldUseCustomProviderRegistryToFillFields(){
        EasyRandomParameters parameters = new EasyRandomParameters().randomize(ProtobufPredicates.named("int32Field"), () -> 42);
        EasyRandom easyRandom = new EasyRandom(parameters);

        Proto3Message protoInstance = easyRandom.nextObject(Proto3Message.class);

        assertThat(protoInstance.getInt32Field()).isEqualTo(42);
    }

I've found a solution and pushed it to my fork, will create PR now because it involves exposing EasyRandomParameters's custom randomizer provider so that we are able to access it. Any suggestion is welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant