@Test public void mandatoryParametersReassignment() { String stringField1 = "42"; String stringField2 = "69"; SomeObject someObjectField = new SomeObject(); MandatoryBeanBuilder builder = MandatoryBeanBuilder.create(stringField1, someObjectField); builder.stringField(stringField2); MandatoryBean bean = builder.build(); assertSame(stringField2, bean.getStringField()); }
public String getStringField() { return stringField; }
MandatoryBean { public String getStringField() { return stringField; } }
MandatoryBean { public String getStringField() { return stringField; } MandatoryBean(int intField, @Mandatory String stringField, Integer integerField, @Mandatory SomeObject someObjectField); }
MandatoryBean { public String getStringField() { return stringField; } MandatoryBean(int intField, @Mandatory String stringField, Integer integerField, @Mandatory SomeObject someObjectField); int getIntField(); String getStringField(); Integer getIntegerField(); SomeObject getSomeObjectField(); }
MandatoryBean { public String getStringField() { return stringField; } MandatoryBean(int intField, @Mandatory String stringField, Integer integerField, @Mandatory SomeObject someObjectField); int getIntField(); String getStringField(); Integer getIntegerField(); SomeObject getSomeObjectField();  }