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

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


    assertEquals("Matti Meikäläinen 1973", p.toString());
  }

  @Test
  public void testBuilderCanBeReusedIfNothingIsRewritten() {
    PersonBuilder someMeikalainenWith = Person.with().lastName(
        "Meikäläinen");
    Person matti = someMeikalainenWith.firstName("Matti").birthYear(1973)
        .end();
    Person maija = someMeikalainenWith.firstName("Maija").birthYear(1976)
        .end();
    assertEquals("Matti Meikäläinen 1973", matti.toString());
    assertEquals("Maija Meikäläinen 1976", maija.toString());
  }
View Full Code Here


    assertEquals("Maija Meikäläinen 1976", maija.toString());
  }

  @Test
  public void testBuilderCannotBeReusedWithRewrites() {
    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());
    // note that 1973 leaked to kalleKustaa:
View Full Code Here

TOP

Related Classes of net.sf.gluent.doc.fluentpatterns.basicbuilder.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.