use of org.apache.isis.schema.common.v1.OidDto 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());
}
Aggregations