Skip to content

Protobuf randomizer not using custom randomizers #33

Open
@carborgar

Description

@carborgar

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions