DocumentStoreException extends RuntimeException { public static DocumentStoreException asDocumentStoreException(String message, Throwable t, Type type, Iterable<String> ids) { String msg = message; if (ids.iterator().hasNext()) { msg += " " + Lists.newArrayList(ids); } if (t instanceof DocumentStoreException) { return (DocumentStoreException) t; } else { return new DocumentStoreException(msg, t, type); } } DocumentStoreException(String message);  DocumentStoreException(Throwable cause);  DocumentStoreException(String message, Throwable cause);  DocumentStoreException(String message, Throwable cause, Type type); static DocumentStoreException convert(@NotNull Throwable t); static DocumentStoreException convert(@NotNull Throwable t, String msg); static DocumentStoreException convert(@NotNull Throwable t,
                                                 Iterable<String> ids); static DocumentStoreException asDocumentStoreException(String message,
                                                                  Throwable t,
                                                                  Type type,
                                                                  Iterable<String> ids); Type getType();  }
@Test public void asDocumentStoreException() { String msg = "foo"; Exception cause = new IOException(); Type type = TRANSIENT; List<String> ids = Lists.newArrayList("one", "two", "three"); DocumentStoreException dse = DocumentStoreException.asDocumentStoreException(msg, cause, type, ids); assertTrue(dse.getMessage().contains(msg)); for (String id : ids) { assertTrue(dse.getMessage().contains(id)); } assertSame(cause, dse.getCause()); assertEquals(type, dse.getType()); }