use of ch.aaap.harvestclient.api.filter.ClientContactFilter in project harvest-client by 3AP-AG.
the class ClientContactsApiListTest method listByClient.
@Test
void listByClient() {
Reference<Client> anotherClientReference = ExistingData.getInstance().getAnotherClientReference();
ClientContact creationInfo = ImmutableClientContact.builder().client(anotherClientReference).firstName("inactive test ClientContact").build();
clientContact = clientContactsApi.create(creationInfo);
ClientContactFilter filter = new ClientContactFilter();
filter.setClientReference(anotherClientReference);
List<ClientContact> clientContacts = clientContactsApi.list(filter);
assertThat(clientContacts).usingFieldByFieldElementComparator().contains(clientContact);
}
use of ch.aaap.harvestclient.api.filter.ClientContactFilter in project harvest-client by 3AP-AG.
the class ClientContactsApiListTest method listByUpdatedSince.
@Test
void listByUpdatedSince() {
Instant creationTime = Instant.now().minusSeconds(1);
ClientContact creationInfo = ImmutableClientContact.builder().client(clientReference).firstName("newly created test ClientContact").build();
clientContact = clientContactsApi.create(creationInfo);
ClientContactFilter filter = new ClientContactFilter();
filter.setUpdatedSince(creationTime);
List<ClientContact> clientContacts = clientContactsApi.list(filter);
assertThat(clientContacts).usingFieldByFieldElementComparator().containsExactly(clientContact);
}
use of ch.aaap.harvestclient.api.filter.ClientContactFilter 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.api.filter.ClientContactFilter 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();
}
Aggregations