本文整理汇总了Java中com.google.common.base.Throwables.throwIfInstanceOf方法的典型用法代码示例。如果您正苦于以下问题:Java Throwables.throwIfInstanceOf方法的具体用法?Java Throwables.throwIfInstanceOf怎么用?Java Throwables.throwIfInstanceOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.base.Throwables
的用法示例。
在下文中一共展示了Throwables.throwIfInstanceOf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testOnReceiveBatchedModificationsReadyWithIncorrectTotalMessageCount
import com.google.common.base.Throwables; //导入方法依赖的package包/类
@Test(expected = IllegalStateException.class)
public void testOnReceiveBatchedModificationsReadyWithIncorrectTotalMessageCount() throws Exception {
new JavaTestKit(getSystem()) {
{
final ActorRef transaction = newTransactionActor(WO, readWriteTransaction(),
"testOnReceiveBatchedModificationsReadyWithIncorrectTotalMessageCount");
JavaTestKit watcher = new JavaTestKit(getSystem());
watcher.watch(transaction);
BatchedModifications batched = new BatchedModifications(nextTransactionId(),
DataStoreVersions.CURRENT_VERSION);
batched.setReady(true);
batched.setTotalMessagesSent(2);
transaction.tell(batched, getRef());
Failure failure = expectMsgClass(duration("5 seconds"), akka.actor.Status.Failure.class);
watcher.expectMsgClass(duration("5 seconds"), Terminated.class);
if (failure != null) {
Throwables.throwIfInstanceOf(failure.cause(), Exception.class);
Throwables.throwIfUnchecked(failure.cause());
throw new RuntimeException(failure.cause());
}
}
};
}