Andrei Branza - converted indents to spaces test classes

This commit is contained in:
Andrei Branza 2024-02-24 21:18:38 +02:00
parent 54851a8042
commit 93020dc544
2 changed files with 17 additions and 17 deletions

View File

@ -7,17 +7,17 @@ import static org.junit.Assert.assertNotEquals;
public class DeepCloningTest { public class DeepCloningTest {
Person alex = new Person("Alex", "Jones", new Address("Main Street", "Main City")); Person alex = new Person("Alex", "Jones", new Address("Main Street", "Main City"));
@Test @Test
public void whenUsingDeepCopy_thenReferencesAreNotTheSame() public void whenUsingDeepCopy_thenReferencesAreNotTheSame()
{ {
Person constructorCopyOfAlex = new Person(alex); Person constructorCopyOfAlex = new Person(alex);
assertEquals(alex, constructorCopyOfAlex); assertEquals(alex, constructorCopyOfAlex);
alex.setAddress(new Address("Unknown Street", "Unknown City")); alex.setAddress(new Address("Unknown Street", "Unknown City"));
assertNotEquals(alex.getAddress(), constructorCopyOfAlex.getAddress()); assertNotEquals(alex.getAddress(), constructorCopyOfAlex.getAddress());
} }
} }

View File

@ -5,17 +5,17 @@ import static org.junit.Assert.*;
public class ShallowCloningTest { public class ShallowCloningTest {
Person alex = new Person("Alex", "Jones", new Address("Main Street", "Main City")); Person alex = new Person("Alex", "Jones", new Address("Main Street", "Main City"));
@Test @Test
public void whenUsingShallowCopy_ThenReferencesAreTheSame() public void whenUsingShallowCopy_ThenReferencesAreTheSame()
{ {
Person shallowCopyOfAlex = alex.clone(); Person shallowCopyOfAlex = alex.clone();
assertEquals(alex, shallowCopyOfAlex); assertEquals(alex, shallowCopyOfAlex);
alex.getAddress().setCityName("Unknown City"); alex.getAddress().setCityName("Unknown City");
assertEquals(alex.getAddress(), shallowCopyOfAlex.getAddress()); assertEquals(alex.getAddress(), shallowCopyOfAlex.getAddress());
} }
} }