use of org.estatio.module.party.dom.Organisation in project estatio by estatio.
the class Order_Test method minimalRequiredDataToComplete_consitent_dimensions_for_project_budgetItem.
@Test
public void minimalRequiredDataToComplete_consitent_dimensions_for_project_budgetItem() throws Exception {
// given
Order order = new Order();
OrderItem item1 = new OrderItem();
order.getItems().add(item1);
order.setOrderNumber("123");
order.setBuyer(new Organisation());
order.setSeller(new Organisation());
item1.setNetAmount(new BigDecimal("100"));
item1.setDescription("blah");
item1.setGrossAmount(BigDecimal.ZERO);
item1.setCharge(new Charge());
item1.setStartDate(new LocalDate());
item1.setEndDate(new LocalDate());
item1.setProperty(new Property());
// when
item1.setBudgetItem(new BudgetItem());
item1.setProject(new Project());
String result = order.reasonIncomplete();
// then
assertThat(result).isEqualTo("(on item) either project or budget item - not both required");
}
use of org.estatio.module.party.dom.Organisation in project estatio by estatio.
the class Order_Test method minimalRequiredDataToComplete_consitent_dimensions_for_property_budgetItem.
@Test
public void minimalRequiredDataToComplete_consitent_dimensions_for_property_budgetItem() throws Exception {
// given
Order order = new Order();
OrderItem item1 = new OrderItem();
order.getItems().add(item1);
order.setOrderNumber("123");
order.setBuyer(new Organisation());
order.setSeller(new Organisation());
item1.setNetAmount(new BigDecimal("100"));
item1.setDescription("blah");
item1.setGrossAmount(BigDecimal.ZERO);
item1.setCharge(new Charge());
item1.setStartDate(new LocalDate());
item1.setEndDate(new LocalDate());
// when
item1.setBudgetItem(new BudgetItem());
String result = order.reasonIncomplete();
// then
assertThat(result).isEqualTo("(on item) when budget item filled in then property required");
}
use of org.estatio.module.party.dom.Organisation in project estatio by estatio.
the class PartyRelationshipType_Test method createFor.
@Test
public void createFor() {
Person p = new Person();
Organisation o = new Organisation();
PartyRelationship pr = PartyRelationshipTypeEnum.createWithToTitle(o, p, PartyRelationshipTypeEnum.EMPLOYMENT.toTitle());
assertThat((Organisation) pr.getFrom()).isEqualTo(o);
}
use of org.estatio.module.party.dom.Organisation in project estatio by estatio.
the class PartyDtoFactory_Test method happy_case.
@Test
public void happy_case() throws Exception {
// given
final Party p = new Organisation();
p.setReference("12345678");
p.setName("New Company");
// expecting
final OidDto partyOidDto = new OidDto();
context.checking(new Expectations() {
{
oneOf(mockDtoMappingHelper).oidDtoFor(p);
will(returnValue(partyOidDto));
oneOf(mockCommunicationChannelRepository).findByOwnerAndType(p, CommunicationChannelType.POSTAL_ADDRESS);
will(returnValue(Collections.emptySortedSet()));
}
});
// when
PartyDto partyDto = partyDtoFactory.newDto(p);
// and when roundtrip
String xml = jaxbService.toXml(partyDto);
PartyDto partyDtoAfter = jaxbService.fromXml(PartyDto.class, xml);
// then
assertThat(partyDtoAfter.getName()).isEqualTo(p.getName());
assertThat(partyDtoAfter.getReference()).isEqualTo(p.getReference());
}
use of org.estatio.module.party.dom.Organisation in project estatio by estatio.
the class ChamberOfCommerceCodeLookUpServiceTest method getChamberOfCommerceCodeCandidatesByOrganisation_works.
@Test
public void getChamberOfCommerceCodeCandidatesByOrganisation_works() throws Exception {
// given
ChamberOfCommerceCodeLookUpService service = new ChamberOfCommerceCodeLookUpService() {
@Override
List<OrganisationNameNumberViewModel> findCandidatesForFranceByName(final String name) {
return Arrays.asList(new OrganisationNameNumberViewModel(), new OrganisationNameNumberViewModel(), new OrganisationNameNumberViewModel());
}
};
Organisation organisation = new Organisation() {
@Override
public String getAtPath() {
return "/FRA";
}
};
organisation.setName("Company");
// when
List<OrganisationNameNumberViewModel> result = service.getChamberOfCommerceCodeCandidatesByOrganisation(organisation);
// then
Assertions.assertThat(result.size()).isEqualTo(3);
}
Aggregations