diff options
Diffstat (limited to 'infra/translate-api/src/test')
2 files changed, 26 insertions, 4 deletions
diff --git a/infra/translate-api/src/test/java/io/fd/honeycomb/translate/write/registry/BulkUpdateExceptionTest.java b/infra/translate-api/src/test/java/io/fd/honeycomb/translate/write/registry/BulkUpdateExceptionTest.java index ae0c36d5b..9623db5bc 100644 --- a/infra/translate-api/src/test/java/io/fd/honeycomb/translate/write/registry/BulkUpdateExceptionTest.java +++ b/infra/translate-api/src/test/java/io/fd/honeycomb/translate/write/registry/BulkUpdateExceptionTest.java @@ -20,6 +20,7 @@ import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.verify; import com.google.common.collect.Sets; +import io.fd.honeycomb.translate.write.DataObjectUpdate; import io.fd.honeycomb.translate.write.WriteContext; import java.util.HashSet; import org.junit.Before; @@ -35,9 +36,12 @@ public class BulkUpdateExceptionTest { @Mock private WriteContext writeContext; - @Mock private WriterRegistry.Reverter reverter; + @Mock + private DataObject before; + @Mock + private DataObject after; @Before public void setUp() throws Exception { @@ -48,9 +52,10 @@ public class BulkUpdateExceptionTest { public void testRevert() throws Exception { final HashSet<InstanceIdentifier<?>> failedIds = Sets.newHashSet(id); final WriterRegistry.BulkUpdateException bulkUpdateException = - new WriterRegistry.BulkUpdateException(failedIds, reverter, new RuntimeException()); + new WriterRegistry.BulkUpdateException(id, DataObjectUpdate.create(id, before, after), + failedIds, reverter, new RuntimeException()); - assertEquals(failedIds, bulkUpdateException.getFailedIds()); + assertEquals(failedIds, bulkUpdateException.getUnrevertedSubtrees()); bulkUpdateException.revertChanges(writeContext); verify(reverter).revert(writeContext); diff --git a/infra/translate-api/src/test/java/io/fd/honeycomb/translate/write/registry/RevertFailedExceptionTest.java b/infra/translate-api/src/test/java/io/fd/honeycomb/translate/write/registry/RevertFailedExceptionTest.java index 721941d1e..6502235d0 100644 --- a/infra/translate-api/src/test/java/io/fd/honeycomb/translate/write/registry/RevertFailedExceptionTest.java +++ b/infra/translate-api/src/test/java/io/fd/honeycomb/translate/write/registry/RevertFailedExceptionTest.java @@ -19,20 +19,37 @@ package io.fd.honeycomb.translate.write.registry; import static org.junit.Assert.assertEquals; import com.google.common.collect.Sets; +import io.fd.honeycomb.translate.write.DataObjectUpdate; import java.util.Set; +import org.junit.Before; import org.junit.Test; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public class RevertFailedExceptionTest { private InstanceIdentifier<?> id = InstanceIdentifier.create(DataObject.class); + @Mock + private WriterRegistry.Reverter reverter; + @Mock + private DataObject before; + @Mock + private DataObject after; + + @Before + public void setUp() throws Exception { + MockitoAnnotations.initMocks(this); + } @Test public void testNonRevert() throws Exception { final Set<InstanceIdentifier<?>> notReverted = Sets.newHashSet(id); final WriterRegistry.Reverter.RevertFailedException revertFailedException = - new WriterRegistry.Reverter.RevertFailedException(notReverted, new RuntimeException()); + new WriterRegistry.Reverter.RevertFailedException( + new WriterRegistry.BulkUpdateException(id, DataObjectUpdate.create(id, before, after), + notReverted, reverter, new RuntimeException())); assertEquals(notReverted, revertFailedException.getNotRevertedChanges()); } }
\ No newline at end of file |