Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added AddressPartTest.java #793

Merged
merged 8 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions src/test/java/org/openelisglobal/address/AddressPartTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package org.openelisglobal.address;

import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
import org.openelisglobal.address.valueholder.AddressPart;

public class AddressPartTest {

private AddressPart addressPart;

@Before
public void setUp() {
addressPart = new AddressPart();
}

@Test
public void testSetAndGetId() {
sayed4900 marked this conversation as resolved.
Show resolved Hide resolved
String id = "123";
addressPart.setId(id);
assertEquals(id, addressPart.getId());
}

@Test
public void testSetAndGetPartName() {
String partName = "Street";
sayed4900 marked this conversation as resolved.
Show resolved Hide resolved
addressPart.setPartName(partName);
assertEquals(partName, addressPart.getPartName());
}

@Test
public void testSetAndGetDisplayOrder() {
String displayOrder = "1";
sayed4900 marked this conversation as resolved.
Show resolved Hide resolved
addressPart.setDisplayOrder(displayOrder);
assertEquals(displayOrder, addressPart.getDisplayOrder());
}
}

51 changes: 51 additions & 0 deletions src/test/java/org/openelisglobal/address/AdressPKTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package org.openelisglobal.address;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.openelisglobal.address.valueholder.AddressPK;

public class AdressPKTest {

private AddressPK addressPK;

@Before
public void setUp() {
addressPK = new AddressPK();
}

@Test
public void testSetAndGetTargetId() {
String targetId = "123";
addressPK.setTargetId(targetId);
Assert.assertEquals(targetId, addressPK.getTargetId());
}

@Test
public void testSetAndGetAddressPartId() {
String addressPartId = "456";
addressPK.setAddressPartId(addressPartId);
Assert.assertEquals(addressPartId, addressPK.getAddressPartId());
}

@Test
public void testEqualsAndHashCode() {
AddressPK addressPK1 = new AddressPK();
addressPK1.setTargetId("123");
addressPK1.setAddressPartId("456");

AddressPK addressPK2 = new AddressPK();
addressPK2.setTargetId("123");
addressPK2.setAddressPartId("456");

AddressPK addressPK3 = new AddressPK();
addressPK3.setTargetId("789");
addressPK3.setAddressPartId("101");

Assert.assertEquals(addressPK1, addressPK2);
Assert.assertNotEquals(addressPK1, addressPK3);
Assert.assertEquals(addressPK1.hashCode(), addressPK2.hashCode());
Assert.assertNotEquals(addressPK1.hashCode(), addressPK3.hashCode());
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package org.openelisglobal.address;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.openelisglobal.address.valueholder.OrganizationAddress;

public class OrganizationAddressTest {

private OrganizationAddress organizationAddress;

@Before
public void setUp() {
organizationAddress = new OrganizationAddress();
}

@Test
sayed4900 marked this conversation as resolved.
Show resolved Hide resolved
public void testSetAndGetOrganizationId() {
String organizationId = "123";
organizationAddress.setOrganizationId(organizationId);
Assert.assertEquals(organizationId, organizationAddress.getOrganizationId());
}

@Test
sayed4900 marked this conversation as resolved.
Show resolved Hide resolved
public void testSetAndGetAddressPartId() {
String addressPartId = "456";
organizationAddress.setAddressPartId(addressPartId);
Assert.assertEquals(addressPartId, organizationAddress.getAddressPartId());
}

@Test
public void testSetAndGetUniqueIdentifier() {
String uniqueIdentifier = "unique123";
organizationAddress.setUniqueIdentifyer(uniqueIdentifier);
Assert.assertEquals(uniqueIdentifier, organizationAddress.getUniqueIdentifyer());
}

@Test
sayed4900 marked this conversation as resolved.
Show resolved Hide resolved
public void testGetStringId() {
String organizationId = "123";
sayed4900 marked this conversation as resolved.
Show resolved Hide resolved
String addressPartId = "456";
organizationAddress.setOrganizationId(organizationId);
organizationAddress.setAddressPartId(addressPartId);
String expectedStringId = organizationId + addressPartId;
Assert.assertEquals(expectedStringId, organizationAddress.getStringId());
}

// Add more test cases for other methods as needed
}
52 changes: 52 additions & 0 deletions src/test/java/org/openelisglobal/address/PersonAddressTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package org.openelisglobal.address;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.openelisglobal.address.valueholder.PersonAddress;

sayed4900 marked this conversation as resolved.
Show resolved Hide resolved
public class PersonAddressTest {

private PersonAddress personAddress;

@Before
public void setUp() {
personAddress = new PersonAddress();
}

@Test
public void testSetAndGetPersonId() {
String personId = "123";
personAddress.setPersonId(personId);
Assert.assertEquals(personId, personAddress.getPersonId());
}

@Test
public void testSetAndGetAddressPartId() {
String addressPartId = "456";
personAddress.setAddressPartId(addressPartId);
Assert.assertEquals(addressPartId, personAddress.getAddressPartId());
}

@Test
public void testSetAndGetUniqueIdentifier() {
String uniqueIdentifier = "unique123";
personAddress.setUniqueIdentifyer(uniqueIdentifier);
Assert.assertEquals(uniqueIdentifier, personAddress.getUniqueIdentifyer());
}

@Test
public void testGetStringId() {
String personId = "123";
String addressPartId = "456";
personAddress.setPersonId(personId);
personAddress.setAddressPartId(addressPartId);
String expectedStringId = personId + addressPartId;
Assert.assertEquals(expectedStringId, personAddress.getStringId());
}

// Add more test cases for other methods as needed
}