Package net.sf.gluent.doc.fluentpatterns.immutablebuilder.Person

Examples of net.sf.gluent.doc.fluentpatterns.immutablebuilder.Person.PersonBuilder


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:
View Full Code Here

TOP

Related Classes of net.sf.gluent.doc.fluentpatterns.immutablebuilder.Person.PersonBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.