use of io.lumeer.api.model.CompanyContact in project engine by Lumeer.
the class CompanyContactFacade method getCompanyContact.
public CompanyContact getCompanyContact(final Organization organization) {
checkManagePermissions(organization);
final CompanyContact companyContact = companyContactDao.getCompanyContact(organization);
if (companyContact == null) {
return new CompanyContact(null, organization.getCode(), "", "", "", "", "", "", "", "", "", "", "", "", "");
}
return companyContact;
}
use of io.lumeer.api.model.CompanyContact in project engine by Lumeer.
the class OrganizationServiceIT method testCompanyContact.
@Test
public void testCompanyContact() {
createOrganization(CODE1);
CompanyContact contact = getCompanyContact(CODE1);
assertThat(contact.getCode()).isEqualTo(CODE1);
assertThat(contact.getCompany()).isEmpty();
assertThat(contact.getFirstName()).isEmpty();
assertThat(contact.getLastName()).isEmpty();
assertThat(contact.getAddress1()).isEmpty();
assertThat(contact.getAddress2()).isEmpty();
assertThat(contact.getState()).isEmpty();
assertThat(contact.getCity()).isEmpty();
assertThat(contact.getCountry()).isEmpty();
assertThat(contact.getIc()).isEmpty();
assertThat(contact.getDic()).isEmpty();
assertThat(contact.getEmail()).isEmpty();
assertThat(contact.getPhone()).isEmpty();
// set a new contact
contact = setCompanyContact(CODE1, CONTACT);
// we have an id from db, store it for later double check
assertThat(contact.getId()).isNotEmpty();
final String originalId = contact.getId();
// the id is dynamic
contact.setId(CONTACT.getId());
assertThat(contact).isEqualTo(CONTACT);
// verify that it has been set
contact = getCompanyContact(CODE1);
// make sure the id matches
assertThat(contact.getId()).isEqualTo(originalId);
// and then delete it so that it equals with our template contact
contact.setId(CONTACT.getId());
assertThat(contact).isEqualTo(CONTACT);
}
Aggregations