WalletExceptionConverter implements ExceptionConverter<HerajException> { @Override public HerajException convert(final Throwable t) { logger.debug("Handle exception {}", t.toString()); if (t instanceof HerajException) { return (HerajException) t; } else { return new HerajException(t); } }  @Override HerajException convert(final Throwable t);  }
@Test public void testConvert() { final Throwable[] parameters = { new HerajException(""), new UnsupportedOperationException() }; final Class<?>[] expected = { HerajException.class, HerajException.class }; final WalletExceptionConverter converter = new WalletExceptionConverter(); for (int i = 0; i < parameters.length; ++i) { final Throwable parameter = parameters[i]; final Class<?> expectedClass = expected[i]; final HerajException actual = converter.convert(parameter); assertEquals(actual.getClass(), expectedClass); } }