Refactor examples

This commit is contained in:
Grzegorz Piwowarek 2016-07-30 12:56:20 +02:00
parent eef41ec028
commit f5dbb497df
3 changed files with 6 additions and 6 deletions

View File

@ -9,12 +9,12 @@ public class ImmutablePersonTest {
@Test @Test
public void whenModifying_shouldCreateNewInstance() throws Exception { public void whenModifying_shouldCreateNewInstance() throws Exception {
final com.baeldung.immutable.ImmutablePerson john = com.baeldung.immutable.ImmutablePerson.builder() final ImmutablePerson john = ImmutablePerson.builder()
.age(42) .age(42)
.name("John") .name("John")
.build(); .build();
final com.baeldung.immutable.ImmutablePerson john43 = john.withAge(43); final ImmutablePerson john43 = john.withAge(43);
assertThat(john) assertThat(john)
.isNotSameAs(john43); .isNotSameAs(john43);
@ -22,6 +22,6 @@ public class ImmutablePersonTest {
assertThat(john.getAge()) assertThat(john.getAge())
.isEqualTo(42); .isEqualTo(42);
assertImmutable(com.baeldung.immutable.ImmutablePerson.class); assertImmutable(ImmutablePerson.class);
} }
} }

View File

@ -8,13 +8,13 @@ public class ImmutablePersonAuxiliaryTest {
@Test @Test
public void whenComparing_shouldIgnore() throws Exception { public void whenComparing_shouldIgnore() throws Exception {
final com.baeldung.immutable.auxiliary.ImmutablePerson john1 = com.baeldung.immutable.auxiliary.ImmutablePerson.builder() final ImmutablePerson john1 = ImmutablePerson.builder()
.name("John") .name("John")
.age(42) .age(42)
.auxiliaryField("Value1") .auxiliaryField("Value1")
.build(); .build();
final com.baeldung.immutable.auxiliary.ImmutablePerson john2 = com.baeldung.immutable.auxiliary.ImmutablePerson.builder() final ImmutablePerson john2 = ImmutablePerson.builder()
.name("John") .name("John")
.age(42) .age(42)
.auxiliaryField("Value2") .auxiliaryField("Value2")

View File

@ -9,7 +9,7 @@ public class ImmutablePersonDefaultTest {
@Test @Test
public void whenInstantiating_shouldUseDefaultValue() throws Exception { public void whenInstantiating_shouldUseDefaultValue() throws Exception {
final com.baeldung.immutable.default_.ImmutablePerson john = com.baeldung.immutable.default_.ImmutablePerson.builder().name("John").build(); final ImmutablePerson john = ImmutablePerson.builder().name("John").build();
assertThat(john.getAge()).isEqualTo(42); assertThat(john.getAge()).isEqualTo(42);