@Override public void onBlipContributorsChanged(BlipContributorsChangedEvent e) { calledEvents.add(e.getType()); } };
public void refactor_testSerializeAndDeserializeBlipEvent() throws Exception { List<String> contributorsAdded = new ArrayList<String>(); contributorsAdded.add("foo@google.com"); contributorsAdded.add("bar@google.com"); List<String> contributorsRemoved = new ArrayList<String>(); contributorsRemoved.add("baz@google.com"); Blip blip = mock(Blip.class); when(blip.getBlipId()).thenReturn("blip123"); Wavelet wavelet = mock(Wavelet.class); when(wavelet.getBlip("blip123")).thenReturn(blip); EventMessageBundle bundle = new EventMessageBundle("http://10.1.1.1", "http://wave-active-api.example.com"); BlipContributorsChangedEvent expected = new BlipContributorsChangedEvent(wavelet, bundle, "mprasetya@google.com", 1l, "blip123", contributorsAdded, contributorsRemoved); Context context = new Context(); Event actualEvent = EventSerializer.deserialize(wavelet, bundle, EventSerializer.serialize(expected, context), context); BlipContributorsChangedEvent actual = BlipContributorsChangedEvent.as(actualEvent); assertEquals(expected, actual); assertEquals(expected.getContributorsAdded(), actual.getContributorsAdded()); assertEquals(expected.getContributorsRemoved(), actual.getContributorsRemoved()); }
break; case BLIP_CONTRIBUTORS_CHANGED: onBlipContributorsChanged(BlipContributorsChangedEvent.as(event)); break; case BLIP_SUBMITTED:
public void refactor_testSerializeAndDeserializeBlipEvent() throws Exception { List<String> contributorsAdded = new ArrayList<String>(); contributorsAdded.add("foo@google.com"); contributorsAdded.add("bar@google.com"); List<String> contributorsRemoved = new ArrayList<String>(); contributorsRemoved.add("baz@google.com"); Blip blip = mock(Blip.class); when(blip.getBlipId()).thenReturn("blip123"); Wavelet wavelet = mock(Wavelet.class); when(wavelet.getBlip("blip123")).thenReturn(blip); EventMessageBundle bundle = new EventMessageBundle("http://10.1.1.1", "http://wave-active-api.example.com"); BlipContributorsChangedEvent expected = new BlipContributorsChangedEvent(wavelet, bundle, "mprasetya@google.com", 1l, "blip123", contributorsAdded, contributorsRemoved); Context context = new Context(); Event actualEvent = EventSerializer.deserialize(wavelet, bundle, EventSerializer.serialize(expected, context), context); BlipContributorsChangedEvent actual = BlipContributorsChangedEvent.as(actualEvent); assertEquals(expected, actual); assertEquals(expected.getContributorsAdded(), actual.getContributorsAdded()); assertEquals(expected.getContributorsRemoved(), actual.getContributorsRemoved()); }
@Override public void onBlipContributorsChanged(BlipContributorsChangedEvent e) { calledEvents.add(e.getType()); } };