use of ch.aaap.harvestclient.domain.Client in project harvest-client by 3AP-AG.
the class ClientsApiImpl method create.
@Override
public Client create(Client creationInfo) {
Call<Client> call = service.create(creationInfo);
Client client = ExceptionHandler.callOrThrow(call);
log.debug("Created {}", client);
return client;
}
use of ch.aaap.harvestclient.domain.Client in project harvest-client by 3AP-AG.
the class ProjectsApiCreateTest method createDefaultBudget.
@ParameterizedTest
@EnumSource(Project.BudgetMethod.class)
void createDefaultBudget(Project.BudgetMethod budgetMethod, TestInfo testInfo) {
Reference<Client> clientReference = ExistingData.getInstance().getClientReference();
String name = "Project for test " + testInfo.getDisplayName();
boolean billable = true;
Project.BillingMethod billBy = Project.BillingMethod.PROJECT;
Project creationInfo = ImmutableProject.builder().client(clientReference).name(name).billable(billable).billBy(billBy).budgetBy(budgetMethod).build();
project = projectsApi.create(creationInfo);
assertThat(project.getBillable()).isEqualTo(billable);
assertThat(project.getBillBy()).isEqualTo(billBy);
assertThat(project.getBudgetBy()).isEqualTo(budgetMethod);
assertThat(project.getName()).isEqualTo(name);
assertThat(project.getClient().getId()).isEqualTo(clientReference.getId());
}
use of ch.aaap.harvestclient.domain.Client in project harvest-client by 3AP-AG.
the class ProjectsApiUpdateTest method beforeEach.
@BeforeEach
void beforeEach(TestInfo testInfo) {
Reference<Client> clientReference = ExistingData.getInstance().getClientReference();
String name = "Project for test " + testInfo.getDisplayName();
boolean billable = true;
Project.BillingMethod billBy = Project.BillingMethod.PROJECT;
Project.BudgetMethod budgetBy = Project.BudgetMethod.HOURS_PER_TASK;
Project creationInfo = ImmutableProject.builder().client(clientReference).name(name).billable(billable).billBy(billBy).budgetBy(budgetBy).build();
project = projectsApi.create(creationInfo);
}
use of ch.aaap.harvestclient.domain.Client in project harvest-client by 3AP-AG.
the class ClientsApiCreateTest method create.
@Test
void create() {
String name = "test Client";
Client creationInfo = ImmutableClient.builder().name(name).build();
client = clientsApi.create(creationInfo);
assertThat(client.getName()).isEqualTo(name);
Client gottenClient = clientsApi.get(client);
assertThat(gottenClient).isEqualTo(gottenClient);
}
use of ch.aaap.harvestclient.domain.Client in project harvest-client by 3AP-AG.
the class ClientsApiCreateTest method createInvalidCurrency.
/*
* This test will fail if the test company is setup with a different currency
*/
@Test
void createInvalidCurrency() {
String currency = "EU";
Client creationInfo = ImmutableClient.builder().name("Test client").currency(currency).build();
client = clientsApi.create(creationInfo);
// Company object does not expose currency, this needs to be set to the test
// account default currency
// setting an invalid one will set it to the company default
assertThat(client.getCurrency()).isEqualTo("USD");
}
Aggregations