/** * Tests that the copy logic in * {@link PrimitiveSupplementImpl#PrimitiveSupplementImpl(PrimitiveSupplement)} * does not trigger any writes. * * This is a regression test for bug 2459305. */ public void testCopySnapshotDoesNotCauseWrites() { FakeConversationView view = FakeConversationView.builder().with(schemas).build(); Wavelet udw = view.getWaveView().createUserData(); PrimitiveSupplement substrate = WaveletBasedSupplement.create(udw); ParticipantId viewer = new ParticipantId("nobody@google.com"); SupplementedWave swave = SupplementedWaveImpl.create(substrate, view, viewer, ALWAYS); // Do something that is readable view.createRoot().addParticipant(viewer); swave.markAsRead(); // Save version to detect writes long udwVersion = udw.getVersion(); // Copy into pojo new PrimitiveSupplementImpl(substrate); // Verify no writes. assertEquals(udwVersion, udw.getVersion()); } }
/** * Tests that the copy logic in * {@link PrimitiveSupplementImpl#PrimitiveSupplementImpl(PrimitiveSupplement)} * does not trigger any writes. * * This is a regression test for bug 2459305. */ public void testCopySnapshotDoesNotCauseWrites() { FakeConversationView view = FakeConversationView.builder().with(schemas).build(); Wavelet udw = view.getWaveView().createUserData(); PrimitiveSupplement substrate = WaveletBasedSupplement.create(udw); ParticipantId viewer = new ParticipantId("nobody@google.com"); SupplementedWave swave = SupplementedWaveImpl.create(substrate, view, viewer, ALWAYS); // Do something that is readable view.createRoot().addParticipant(viewer); swave.markAsRead(); // Save version to detect writes long udwVersion = udw.getVersion(); // Copy into pojo new PrimitiveSupplementImpl(substrate); // Verify no writes. assertEquals(udwVersion, udw.getVersion()); } }