Search in sources :

Example 6 with ClientContact

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);
}
Also used : ImmutableClientContact(ch.aaap.harvestclient.domain.ImmutableClientContact) ClientContact(ch.aaap.harvestclient.domain.ClientContact) HarvestTest(ch.aaap.harvestclient.HarvestTest) Test(org.junit.jupiter.api.Test)

Example 7 with 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);
}
Also used : ImmutableClientContact(ch.aaap.harvestclient.domain.ImmutableClientContact) ClientContact(ch.aaap.harvestclient.domain.ClientContact) ClientContactFilter(ch.aaap.harvestclient.api.filter.ClientContactFilter) HarvestTest(ch.aaap.harvestclient.HarvestTest) Test(org.junit.jupiter.api.Test)

Example 8 with ClientContact

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();
}
Also used : ImmutableClientContact(ch.aaap.harvestclient.domain.ImmutableClientContact) ClientContact(ch.aaap.harvestclient.domain.ClientContact) ClientContactFilter(ch.aaap.harvestclient.api.filter.ClientContactFilter) HarvestTest(ch.aaap.harvestclient.HarvestTest) Test(org.junit.jupiter.api.Test)

Example 9 with ClientContact

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");
}
Also used : ClientContactUpdateInfo(ch.aaap.harvestclient.domain.param.ClientContactUpdateInfo) ImmutableClientContactUpdateInfo(ch.aaap.harvestclient.domain.param.ImmutableClientContactUpdateInfo) ImmutableClientContact(ch.aaap.harvestclient.domain.ImmutableClientContact) ClientContact(ch.aaap.harvestclient.domain.ClientContact) HarvestTest(ch.aaap.harvestclient.HarvestTest) Test(org.junit.jupiter.api.Test)

Example 10 with ClientContact

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());
}
Also used : ClientContactUpdateInfo(ch.aaap.harvestclient.domain.param.ClientContactUpdateInfo) ImmutableClientContactUpdateInfo(ch.aaap.harvestclient.domain.param.ImmutableClientContactUpdateInfo) ImmutableClientContact(ch.aaap.harvestclient.domain.ImmutableClientContact) ClientContact(ch.aaap.harvestclient.domain.ClientContact) HarvestTest(ch.aaap.harvestclient.HarvestTest) Test(org.junit.jupiter.api.Test)

Aggregations

ClientContact (ch.aaap.harvestclient.domain.ClientContact)12 HarvestTest (ch.aaap.harvestclient.HarvestTest)9 ImmutableClientContact (ch.aaap.harvestclient.domain.ImmutableClientContact)9 Test (org.junit.jupiter.api.Test)9 ClientContactFilter (ch.aaap.harvestclient.api.filter.ClientContactFilter)4 Client (ch.aaap.harvestclient.domain.Client)3 ClientContactUpdateInfo (ch.aaap.harvestclient.domain.param.ClientContactUpdateInfo)2 ImmutableClientContactUpdateInfo (ch.aaap.harvestclient.domain.param.ImmutableClientContactUpdateInfo)2 Reference (ch.aaap.harvestclient.domain.reference.Reference)2 Api (ch.aaap.harvestclient.api.Api)1 ClientContactsApi (ch.aaap.harvestclient.api.ClientContactsApi)1 ch.aaap.harvestclient.api.filter (ch.aaap.harvestclient.api.filter)1 Harvest (ch.aaap.harvestclient.core.Harvest)1 User (ch.aaap.harvestclient.domain.User)1 RequestProcessingException (ch.aaap.harvestclient.exception.RequestProcessingException)1 Instant (java.time.Instant)1 List (java.util.List)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 Assertions.assertThatExceptionOfType (org.assertj.core.api.Assertions.assertThatExceptionOfType)1 AfterEach (org.junit.jupiter.api.AfterEach)1