import static org.mockito.Mockito.verify;
import java.lang.reflect.Field;
+import java.util.concurrent.ExecutionException;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.mdsal.common.api.OptimisticLockFailedException;
public void setUp() throws Exception {
reset(IN_MEMORY_DOM_DATA_STORE);
DataTreeSnapshot dataTreeSnapshot = mock(DataTreeSnapshot.class);
- TransactionReadyPrototype transactionReadyPrototype = mock(TransactionReadyPrototype.class);
+ TransactionReadyPrototype<String> transactionReadyPrototype = mock(TransactionReadyPrototype.class);
DataTreeModification dataTreeModification = mock(DataTreeModification.class);
doReturn(dataTreeModification).when(dataTreeSnapshot).newModification();
doReturn("testModification").when(dataTreeModification).toString();
verify(IN_MEMORY_DOM_DATA_STORE).validate(any());
}
- @SuppressWarnings({"checkstyle:IllegalThrows", "checkstyle:IllegalCatch"})
+ @SuppressWarnings({ "checkstyle:IllegalThrows", "checkstyle:avoidHidingCauseException" })
@Test(expected = OptimisticLockFailedException.class)
public void canCommitTestWithOptimisticLockFailedException() throws Throwable {
doThrow(new ConflictingModificationAppliedException(YangInstanceIdentifier.EMPTY, "testException"))
try {
inMemoryDOMStoreThreePhaseCommitCohort.canCommit().get();
fail("Expected exception");
- } catch (Exception e) {
+ } catch (ExecutionException e) {
assertTrue(e.getCause() instanceof OptimisticLockFailedException);
throw e.getCause();
}
}
- @SuppressWarnings({"checkstyle:IllegalThrows", "checkstyle:IllegalCatch"})
+ @SuppressWarnings({ "checkstyle:IllegalThrows", "checkstyle:avoidHidingCauseException" })
@Test(expected = TransactionCommitFailedException.class)
public void canCommitTestWithTransactionCommitFailedException() throws Throwable {
doThrow(new DataValidationFailedException(YangInstanceIdentifier.EMPTY, "testException"))
try {
inMemoryDOMStoreThreePhaseCommitCohort.canCommit().get();
fail("Expected exception");
- } catch (Exception e) {
+ } catch (ExecutionException e) {
assertTrue(e.getCause() instanceof TransactionCommitFailedException);
throw e.getCause();
}
}
- @SuppressWarnings({"checkstyle:IllegalThrows", "checkstyle:IllegalCatch"})
+ @SuppressWarnings({ "checkstyle:IllegalThrows", "checkstyle:avoidHidingCauseException" })
@Test(expected = UnsupportedOperationException.class)
public void canCommitTestWithUnknownException() throws Throwable {
doThrow(new UnsupportedOperationException("testException"))
try {
inMemoryDOMStoreThreePhaseCommitCohort.canCommit().get();
fail("Expected exception");
- } catch (Exception e) {
+ } catch (ExecutionException e) {
assertTrue(e.getCause() instanceof UnsupportedOperationException);
throw e.getCause();
}
verify(IN_MEMORY_DOM_DATA_STORE).prepare(any());
}
- @SuppressWarnings({"checkstyle:IllegalThrows", "checkstyle:IllegalCatch"})
+ @SuppressWarnings({ "checkstyle:IllegalThrows", "checkstyle:avoidHidingCauseException" })
@Test(expected = UnsupportedOperationException.class)
public void preCommitTestWithUnknownException() throws Throwable {
doThrow(new UnsupportedOperationException("testException"))
try {
inMemoryDOMStoreThreePhaseCommitCohort.preCommit().get();
fail("Expected exception");
- } catch (Exception e) {
+ } catch (ExecutionException e) {
assertTrue(e.getCause() instanceof UnsupportedOperationException);
throw e.getCause();
}