@Test public void toString_must_return_all_the_fields() { final Address a1 = Address.builder().withStreet("Foo Bar rd 20") .withCity("San Francisco") .withZip("12345") .withState("CA") .withCountry("USA") .create(); assertThat(a1.toString(), is("Address(street=Foo Bar rd 20, city=San Francisco, state=CA, country=USA, zip=12345)")); } }
@Nonnull public Address toAddress() { return Address.builder().withStreet(street) .withCity(city) .withZip(zip) .withState(state) .withCountry(country) .create(); } }
@Test public void toString_must_return_all_the_fields() { final Address a1 = Address.builder().withStreet("Foo Bar rd 20") .withCity("San Francisco") .withZip("12345") .withState("CA") .withCountry("USA") .create(); final Customer c1 = Customer.builder().withId(new Id("the id")) .withName("Acme Corp.") .withVatNumber("1233455345") .withBillingAddress(a1) .create(); assertThat(c1.toString(), is("InMemoryCustomer(id=the id, name=Acme Corp., billingAddress=Address(street=Foo Bar rd 20, " + "city=San Francisco, state=CA, country=USA, zip=12345), vatNumber=1233455345)")); } }
.withState("GE") .withZip("16145") .withCountry("Italy") .create()) .withVatNumber("IT6546034963") .withState("MI") .withZip("20100") .withCountry("Italy") .create()) .withVatNumber("IT3465346092")
.withZip("12345") .withState("CA") .withCountry("USA") .create(); final Customer c1 = Customer.builder().withId(new Id("1"))