Search in sources :

Example 1 with OidDto

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());
}
Also used : Expectations(org.jmock.Expectations) OidDto(org.apache.isis.schema.common.v1.OidDto) Party(org.estatio.module.party.dom.Party) Organisation(org.estatio.module.party.dom.Organisation) PartyDto(org.estatio.canonical.party.v1.PartyDto) Test(org.junit.Test)

Aggregations

OidDto (org.apache.isis.schema.common.v1.OidDto)1 PartyDto (org.estatio.canonical.party.v1.PartyDto)1 Organisation (org.estatio.module.party.dom.Organisation)1 Party (org.estatio.module.party.dom.Party)1 Expectations (org.jmock.Expectations)1 Test (org.junit.Test)1