### Question:
Exceptions { @SuppressWarnings("unchecked") public static <T extends Throwable> T getFirstThrowableOfType(Throwable from, Class<T> clazz) { return (T) Iterables.tryFind(getCausalChain(from), instanceOf(clazz)).orNull(); }  static boolean isPrefixBoring(Throwable t); static RuntimeException propagate(Throwable throwable); static RuntimeException propagate(String msg, Throwable throwable); static void propagateIfFatal(Throwable throwable); @SuppressWarnings("unchecked") static T getFirstThrowableOfType(Throwable from, Class<T> clazz); static Throwable getFirstThrowableMatching(Throwable from, Predicate<? super Throwable> filter); static Throwable getFirstInteresting(Throwable throwable); static Throwable collapse(Throwable source); static Throwable collapseIncludingAllCausalMessages(Throwable source); static Throwable collapse(Throwable source, boolean collapseCausalChain); static RuntimeException propagateCollapsed(Throwable source); static String collapseText(Throwable t); static String collapseTextIncludingAllCausalMessages(Throwable t); static RuntimeException propagate(Collection<? extends Throwable> exceptions); static RuntimeException propagate(String prefix, Collection<? extends Throwable> exceptions); static Throwable create(Collection<? extends Throwable> exceptions); static RuntimeException create(@Nullable String prefix, Collection<? extends Throwable> exceptions); static boolean isPrefixImportant(Throwable t); static String getPrefixText(Throwable t);  }### Answer:
@Test public void testGetFirstThrowableOfType() throws Exception { NullPointerException npe = new NullPointerException("simulated"); IllegalStateException ise = new IllegalStateException("simulated", npe); assertEquals(Exceptions.getFirstThrowableOfType(ise, IllegalStateException.class), ise); assertEquals(Exceptions.getFirstThrowableOfType(ise, NullPointerException.class), npe); assertNull(Exceptions.getFirstThrowableOfType(ise, IndexOutOfBoundsException.class)); }