use of ch.aaap.harvestclient.domain.ClientContact in project harvest-client by 3AP-AG.
the class ClientContactsApiCreateTest method create.
@Test
void create() {
String firstName = "test First";
ClientContact creationInfo = ImmutableClientContact.builder().client(clientReference).firstName(firstName).build();
clientContact = clientContactsApi.create(creationInfo);
assertThat(clientContact.getFirstName()).isEqualTo(firstName);
ClientContact gotten = clientContactsApi.get(clientContact);
assertThat(gotten).isEqualTo(clientContact);
}
use of ch.aaap.harvestclient.domain.ClientContact in project harvest-client by 3AP-AG.
the class ClientContactsApiListTest method listPaginated.
@Test
void listPaginated() {
Pagination<ClientContact> clientContacts = clientContactsApi.list(new ClientContactFilter(), 1, 1);
List<ClientContact> contacts = clientContacts.getList();
assertThat(contacts).hasSize(1);
assertThat(clientContacts.getNextPage()).isEqualTo(2);
assertThat(clientContacts.getPreviousPage()).isNull();
assertThat(clientContacts.getPerPage()).isEqualTo(1);
assertThat(clientContacts.getTotalPages()).isGreaterThanOrEqualTo(2);
}
use of ch.aaap.harvestclient.domain.ClientContact in project harvest-client by 3AP-AG.
the class ClientContactsApiListTest method list.
@Test
void list() {
List<ClientContact> clientContacts = clientContactsApi.list(new ClientContactFilter());
assertThat(clientContacts).isNotEmpty();
}
use of ch.aaap.harvestclient.domain.ClientContact in project harvest-client by 3AP-AG.
the class ClientContactsApiUpdateTest method changeAll.
@Test
void changeAll() {
// opposites of the defaults
String title = "Mr. ";
String firstName = "test first";
String lastName = "test Last";
String email = "hey@example.com";
String phoneOffice = "006 00 12";
String phoneMobile = "1232 32323 32 ";
String fax = "this is a fax ?";
ClientContactUpdateInfo changes = ImmutableClientContactUpdateInfo.builder().firstName(firstName).lastName(lastName).email(email).phoneMobile(phoneMobile).phoneOffice(phoneOffice).fax(fax).build();
ClientContact updatedClientContact = clientContactsApi.update(clientContact, changes);
assertThat(updatedClientContact).isEqualToComparingOnlyGivenFields(changes, "title", "firstName", "lastName", "email", "phoneOffice", "phoneMobile", "fax");
}
use of ch.aaap.harvestclient.domain.ClientContact in project harvest-client by 3AP-AG.
the class ClientContactsApiUpdateTest method changeFirstName.
@Test
void changeFirstName() {
ClientContactUpdateInfo changes = ImmutableClientContactUpdateInfo.builder().firstName("new clientContact name").build();
ClientContact updatedClientContact = clientContactsApi.update(clientContact, changes);
assertThat(updatedClientContact.getFirstName()).isEqualTo(changes.getFirstName());
}
Aggregations