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

View File

@ -8,13 +8,13 @@ public class ImmutablePersonAuxiliaryTest {
@Test
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")
.age(42)
.auxiliaryField("Value1")
.build();
final com.baeldung.immutable.auxiliary.ImmutablePerson john2 = com.baeldung.immutable.auxiliary.ImmutablePerson.builder()
final ImmutablePerson john2 = ImmutablePerson.builder()
.name("John")
.age(42)
.auxiliaryField("Value2")

View File

@ -9,7 +9,7 @@ public class ImmutablePersonDefaultTest {
@Test
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);