@Nonnull public Project.Builder toBuilder (final @Nonnull Accounting accounting) { try { final Customer customer = accounting.getCustomerRegistry().findCustomers().withId(customerXml.getId()).result(); return new Project.Builder().withId(id) .withCustomer(customer) .withName(name) .withNumber(number) .withDescription(description) .withNotes(notes) .withStatus(status) .withHourlyRate(hourlyRate) .withBudget(budget) .withStartDate(startDate) .withEndDate(endDate) .withEvents(JobEventXml.toJobEvents(jobEventsXml)); } catch (NotFoundException e) { throw new RuntimeException(e); } } }
.withNumber(projectConfig.getString("projectNumber")) .withStatus(status.getMappedStatus()) .withHourlyRate(getHourlyRate(projectConfig, jobEvents)) .withEvents(jobEvents) .create();
.withNotes("Notes for project 1") .withNumber("1") .withHourlyRate(new Money(43, "EUR")) .create(); assertThat(p.toString(), is("InMemoryProject(id=2, customer=InMemoryCustomer(id=1, name=Acme Corp., billingAddress="
.withNumber("PRJ ACME-1") .withEvents(je1) .withHourlyRate(rate1) .withBudget(new Money(123456, "EUR")) .create(); .withNumber("PRJ ACME-2") .withEvents(je2) .withHourlyRate(rate2) .withBudget(new Money(234567, "EUR")) .create(); .withEndDate(project3EndDate) .withNumber("PRJ ACME-3") .withHourlyRate(rate3) .withEvents(je3) .withBudget(new Money(345678, "EUR")) .withEndDate(project4EndDate) .withNumber("PRJ ACME-4") .withHourlyRate(rate4) .withEvents(je4) .withBudget(new Money(456789, "EUR"))