public class ImmutableBuilderTest {
@Test
public void testImmutableBuildersAreProtectedFromEachOther() {
PersonBuilder somePersonWith = Person.with()
.firstName("defaultFirstName").lastName("defaultLastName")
.birthYear(1900);
PersonBuilder someMeikalainenWith = somePersonWith
.lastName("Meikäläinen");
Person mattiMeikalainen = someMeikalainenWith.firstName("Matti")
.birthYear(1973).end();
Person kalleKustaa = somePersonWith.firstName("Kalle")
.lastName("Kustaa").end();
assertEquals("Matti Meikäläinen 1973", mattiMeikalainen.toString());
// now kalleKustaa is protected from Matti's 1973: