Examples of DomainEventSub


Examples of org.dayatang.utils.support.DomainEventSub

    @Before
    public void setUp() throws Exception {
        builder = new GsonSerializerBuilder().dateFormat("yyyy-MM-dd");
        instance = builder.build();
        Date occurredOn = DateUtils.date(2002, 4, 11);
        event = new DomainEventSub(occurredOn, 1);
        event.setId("anId");
        event.setProp1("abc");
        event.setTransientField("transient");
        event.setLastModified(DateUtils.date(2002, 12, 11));
    }
View Full Code Here

Examples of org.dayatang.utils.support.DomainEventSub

    }

    @Test
    public void deserialize() throws Exception {
        String eventBody = "{\"prop1\":\"abc\",\"prop2\":null,\"lastModified\":\"2002-12-11\",\"id\":\"anId\",\"occurredOn\":\"2002-04-11\",\"version\":1}";
        DomainEventSub result = instance.deserialize(eventBody, DomainEventSub.class);
        assertThat(result.getOccurredOn(), is(event.getOccurredOn()));
        assertThat(result.getProp1(), is(event.getProp1()));
        assertThat(result.getVersion(), is(event.getVersion()));
        assertNull(result.getProp2());
    }
View Full Code Here

Examples of org.dayatang.utils.support.DomainEventSub

    @Test
    public void addDeserializationExclusionStrategy() {
        builder = builder.addDeserializationExclusionStrategy(new FieldNameExclusionStrategy("version"));
        instance = builder.build();
        String eventBody = "{\"prop1\":\"abc\",\"lastModified\":\"2002-12-11\",\"id\":\"anId\",\"occurredOn\":\"2002-04-11\",\"version\":100}";
        DomainEventSub result = instance.deserialize(eventBody, DomainEventSub.class);
        assertThat(result.getOccurredOn(), is(DateUtils.date(2002, 4, 11)));
        assertThat(result.getLastModified(), is(DateUtils.date(2002, 12, 11)));
        assertThat(result.getProp1(), is("abc"));
        assertNull(result.getProp2());
        assertThat(result.getId(), is("anId"));
        assertThat(result.getVersion(), is(not(100)));
    }
View Full Code Here

Examples of org.dayatang.utils.support.DomainEventSub

        dto.setId("anId");
        dto.setTransientField("transient");
        dto.setOccurredOn("2002-04-11");
        dto.setProp1("abc");
        dto.setVersion("234");
        DomainEventSub event = instance.deserialize(instance.serialize(dto), DomainEventSub.class);
        assertThat(event.getId(), is("anId"));
        assertThat(event.getOccurredOn(), is(DateUtils.date(2002, 4, 11)));
        assertThat(event.getTransientField(), nullValue());
        assertThat(event.getProp1(), is("abc"));
        assertThat(event.getProp2(), nullValue());
        assertThat(event.getVersion(), is(234));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.