Setting Map
This practice deals with manipulation
setInner
0. Class
public class Generate {
Map<String, String> namesById;
}
1. Generating ArbitraryBuilder
ArbitraryBuilder<Generate> generateBuilder = fixtureMonkey.giveMeBuilder(Generate.class);
2. Altering map size
Setting map without size would result in no change.
Please check out if using size
before setting value
generateBuilder.setInner(
InnerSpec().property("namesById", m -> m.size(5))
);
generateBuilder.setInner(
InnerSpec().property("namesById") { m -> m.size(5) }
)
3. Setting field
Setting entry
generateBuilder.setInner(
InnerSpec().property("namesById", m -> m.entry("key", "value"))
);
generateBuilder.setInner(
InnerSpec().property("namesById") { m -> m.entry("key", "value") }
)
Setting map key
Setting Map key
generateBuilder.setInner(
InnerSpec().property("namesById", m -> m.key("key"))
);
generateBuilder.setInner(
InnerSpec().property("namesById") { m -> m.key("key") }
)
Setting map value
Setting Map value
generateBuilder.setInner(
InnerSpec().property("namesById", m -> m.value("value"))
);
generateBuilder.setInner(
InnerSpec().property("namesById") { m -> m.value("value") }
)