AbstractDestination extends ListenableDestination { @Override public void open() { lastPublishedMutation.set(null); super.open(); started.set(true); }  @Override Mutation<?> getLastPublishedMutation(); @SuppressWarnings("unchecked") @Override void send(@NonNull final List<? extends Mutation<?>> mutations); abstract void publish(List<T> messages); @Override boolean isStarted(); @Override void open(); @Override void close(); @Override void clear();  }
@Test public void testOpen() throws Exception { Mutation.Metadata metadata = mock(Mutation.Metadata.class); when(firstMutation.getMetadata()).thenReturn(metadata); when(metadata.getTimestamp()).thenReturn(0L); destination.send(ImmutableList.of(firstMutation)); assertEquals(firstMutation, destination.getLastPublishedMutation()); destination.open(); assertNull(destination.getLastPublishedMutation()); verify(listener, times(1)).onStart(); }