### Question:
Suppliers2 { @Beta public static <T, X extends Throwable> Supplier<T> onThrowable(final Supplier<T> unlessThrowable, final Class<X> throwable, final Supplier<T> fallback) { return new Supplier<T>() { @Override public T get() { try { return unlessThrowable.get(); } catch (Throwable t) { if (Throwables2.getFirstThrowableOfType(t, throwable) != null) return fallback.get(); throw Throwables.propagate(t); } } @Override public String toString() { return MoreObjects.toStringHelper(this).add("unlessThrowable", unlessThrowable) .add("throwable", throwable.getSimpleName()).add("fallback", fallback).toString(); } }; }  static Supplier<V> getLastValueInMap(final Supplier<Map<K, Supplier<V>>> input); static Supplier<V> getValueInMapOrNull(final Supplier<Map<K, Supplier<V>>> input, final K keyValue); static Function<X, Supplier<X>> ofInstanceFunction(); @Beta static Supplier<T> or(final Supplier<T> unlessNull, final Supplier<T> fallback); @Beta static Supplier<T> onThrowable(final Supplier<T> unlessThrowable,
            final Class<X> throwable, final Supplier<T> fallback);  }### Answer:
@Test public void testOnThrowableWhenFirstThrowsMatchingException() { assertEquals(Suppliers2.onThrowable(new Supplier<String>() { @Override public String get() { throw new NoSuchElementException(); } }, NoSuchElementException.class, Suppliers.ofInstance("foo")).get(), "foo"); }
@Test(expectedExceptions = RuntimeException.class) public void testOnThrowableWhenFirstThrowsUnmatchingException() { Suppliers2.onThrowable(new Supplier<String>() { @Override public String get() { throw new RuntimeException(); } }, NoSuchElementException.class, Suppliers.ofInstance("foo")).get(); }
@Test public void testOnThrowableWhenFirstIsFine() { assertEquals( Suppliers2.onThrowable(Suppliers.<String> ofInstance("foo"), NoSuchElementException.class, Suppliers.ofInstance("bar")).get(), "foo"); }