@Test(groups = "fast") public void testSubscriptionEvent() throws Exception { final EffectiveSubscriptionInternalEvent e = new DefaultEffectiveSubscriptionEvent( UUID.randomUUID(), UUID.randomUUID(), UUID.randomUUID(), new DateTime(), EntitlementState.ACTIVE, "pro", "TRIAL", "DEFAULT", EntitlementState.CANCELLED, null, null, null, 3L, SubscriptionBaseTransitionType.CANCEL, 0, new DateTime(), 1L, 2L, null); final String json = mapper.writeValueAsString(e); final Class<?> claz = Class.forName(DefaultEffectiveSubscriptionEvent.class.getName()); final Object obj = mapper.readValue(json, claz); Assert.assertTrue(obj.equals(e)); }
@Test(groups = "fast") public void testSerialization() throws Exception { final ObjectMapper objectMapper = new ObjectMapper(); final UUID tagDefinitionId = UUID.randomUUID(); final String tagDefinitionName = UUID.randomUUID().toString(); final String tagDefinitionDescription = UUID.randomUUID().toString(); final boolean controlTag = true; final TagDefinition tagDefinition = new DefaultTagDefinition( tagDefinitionId, tagDefinitionName, tagDefinitionDescription, controlTag); final UUID userToken = UUID.randomUUID(); final DefaultControlTagDefinitionCreationEvent event = new DefaultControlTagDefinitionCreationEvent( tagDefinitionId, tagDefinition, 1L, 2L, UUID.randomUUID()); final String json = objectMapper.writeValueAsString(event); final DefaultControlTagDefinitionCreationEvent fromJson = objectMapper.readValue(json, DefaultControlTagDefinitionCreationEvent.class); Assert.assertEquals(fromJson, event); }