use of ch.aaap.harvestclient.domain.ProjectAssignment in project harvest-client by 3AP-AG.
the class ProjectAssignmentsApiImplTest method listUpdatedSinceNow.
@Test
void listUpdatedSinceNow() {
Instant updatedSince = Instant.now();
List<ProjectAssignment> projectAssignments = projectAssignmentsApi.list(userReference, updatedSince);
// nothing was created just now
assertThat(projectAssignments).isEmpty();
}
use of ch.aaap.harvestclient.domain.ProjectAssignment in project harvest-client by 3AP-AG.
the class ProjectAssignmentsApiImplTest method listUpdatedSinceLongAgo.
@Test
void listUpdatedSinceLongAgo() {
Instant updatedSince = Instant.ofEpochSecond(0);
List<ProjectAssignment> projectAssignments = projectAssignmentsApi.list(userReference, updatedSince);
assertThat(projectAssignments).contains(projectAssignment);
}
use of ch.aaap.harvestclient.domain.ProjectAssignment in project harvest-client by 3AP-AG.
the class ProjectAssignmentsApiImplTest method listSelf.
@Test
void listSelf(TestInfo testInfo) {
Project project = null;
try {
final Project tempProject = harvest.projects().create(ImmutableProject.builder().name("Project for " + testInfo.getDisplayName()).billBy(Project.BillingMethod.PROJECT).budgetBy(Project.BudgetMethod.HOURS_PER_PROJECT).billable(false).client(ExistingData.getInstance().getClientReference()).build());
project = tempProject;
User self = harvest.users().getSelf();
// remove self from tempProject
harvest.userAssignments().list(project, new UserAssignmentFilter()).stream().filter(ua -> ua.getUser().getId().equals(self.getId())).forEach(ua -> harvest.userAssignments().delete(tempProject, ua));
List<ProjectAssignment> projectAssignments = projectAssignmentsApi.listSelf();
assertThat(projectAssignments).isNotEmpty();
assertThat(projectAssignments).extracting("project").extracting("id").doesNotContain(tempProject.getId());
} finally {
if (project != null) {
harvest.projects().delete(project);
}
}
}
Aggregations