-
Notifications
You must be signed in to change notification settings - Fork 261
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
109 additions
and
0 deletions.
There are no files selected for viewing
109 changes: 109 additions & 0 deletions
109
src/test/java/org/openelisglobal/address/IntegrationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
package org.openelisglobal.address; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.openelisglobal.address.valueholder.AddressPK; | ||
import org.openelisglobal.address.valueholder.AddressPart; | ||
import org.openelisglobal.address.valueholder.OrganizationAddress; | ||
import org.openelisglobal.address.valueholder.PersonAddress; | ||
import org.openelisglobal.organization.valueholder.Organization; | ||
import org.openelisglobal.person.valueholder.Person; | ||
|
||
|
||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotNull; | ||
|
||
public class IntegrationTest { | ||
|
||
private AddressPart addressPart; | ||
private OrganizationAddress organizationAddress; | ||
private AddressPK addressPK; | ||
private PersonAddress personAddress; | ||
private Organization organization; | ||
private Person person; // Add Person object | ||
|
||
@Before | ||
public void setUp() { | ||
addressPart = new AddressPart(); | ||
organizationAddress = new OrganizationAddress(); | ||
addressPK = new AddressPK(); | ||
personAddress = new PersonAddress(); | ||
organization = new Organization(); | ||
person = new Person(); | ||
} | ||
|
||
|
||
@Test | ||
public void testIntegration() { | ||
// Simulate interactions between the classes | ||
addressPart.setPartName("StreetX"); | ||
organizationAddress.setType("Office"); | ||
addressPK.setTargetId("456"); | ||
addressPK.setAddressPartId("Eg"); | ||
|
||
// Set up person object | ||
person.setId("789"); | ||
person.setFirstName("John"); | ||
person.setLastName("Doe"); | ||
|
||
organizationAddress.setCompoundId(addressPK); | ||
personAddress.setCompoundId(addressPK); | ||
|
||
// Verify that the integrated behavior meets the expected outcomes | ||
assertEquals("StreetX", addressPart.getPartName()); | ||
|
||
assertEquals("Office", organizationAddress.getType()); | ||
assertEquals("456Eg", organizationAddress.getStringId()); | ||
assertEquals(addressPK, organizationAddress.getCompoundId()); | ||
|
||
assertEquals("456", personAddress.getPersonId()); | ||
assertEquals("Eg", personAddress.getAddressPartId()); | ||
|
||
// Verify person object properties | ||
assertEquals("789", person.getId()); | ||
assertEquals("John", person.getFirstName()); | ||
assertEquals("Doe", person.getLastName()); | ||
} | ||
|
||
@Test | ||
public void testOrganizationAddressIntegration() { | ||
// Set up organization and address part | ||
organization.setId("org123"); | ||
addressPart.setId("address123"); | ||
|
||
// Set organization ID and address part ID in organization address | ||
organizationAddress.setOrganizationId(organization.getId()); | ||
organizationAddress.setAddressPartId(addressPart.getId()); | ||
|
||
// Verify that organization address holds correct IDs | ||
assertEquals("org123", organizationAddress.getOrganizationId()); | ||
assertEquals("address123", organizationAddress.getAddressPartId()); | ||
} | ||
|
||
@Test | ||
public void testAddressPartNotNull() { | ||
assertNotNull(addressPart); | ||
} | ||
|
||
@Test | ||
public void testOrganizationAddressNotNull() { | ||
assertNotNull(organizationAddress); | ||
} | ||
|
||
@Test | ||
public void testAddressPKNotNull() { | ||
assertNotNull(addressPK); | ||
} | ||
|
||
@Test | ||
public void testPersonAddressNotNull() { | ||
assertNotNull(personAddress); | ||
} | ||
|
||
@Test | ||
public void testPersonNotNull() { | ||
assertNotNull(person); | ||
} | ||
|
||
} |