@Test void shouldHandleNullExceptionProperly() { InjectorException e = null; InjectorException ex = assertThrows(InjectorException.class, () -> InjectorUtils.rethrowException(e)); assertThat(ex.getMessage(), containsString("An error occurred")); assertThat(ex.getCause(), nullValue()); }
public static void rethrowException(Exception e) throws InjectorException { throw (e instanceof InjectorException) ? (InjectorException) e : new InjectorException("An error occurred (see cause)", e); }
InjectorUtils { public static void rethrowException(Exception e) throws InjectorException { throw (e instanceof InjectorException) ? (InjectorException) e : new InjectorException("An error occurred (see cause)", e); } }
InjectorUtils { public static void rethrowException(Exception e) throws InjectorException { throw (e instanceof InjectorException) ? (InjectorException) e : new InjectorException("An error occurred (see cause)", e); } private  InjectorUtils(); }
InjectorUtils { public static void rethrowException(Exception e) throws InjectorException { throw (e instanceof InjectorException) ? (InjectorException) e : new InjectorException("An error occurred (see cause)", e); } private  InjectorUtils(); static void checkNotNull(Object o); static void checkNotNull(Object o, String errorMessage); @SafeVarargs static void checkNoNullValues(T... arr); static boolean containsNullValue(Object... arr); static void checkArgument(boolean expression, String errorMessage); static void rethrowException(Exception e); @Nullable static T firstNotNull(T obj1, T obj2); static boolean canInstantiate(Class<?> clazz); }
InjectorUtils { public static void rethrowException(Exception e) throws InjectorException { throw (e instanceof InjectorException) ? (InjectorException) e : new InjectorException("An error occurred (see cause)", e); } private  InjectorUtils(); static void checkNotNull(Object o); static void checkNotNull(Object o, String errorMessage); @SafeVarargs static void checkNoNullValues(T... arr); static boolean containsNullValue(Object... arr); static void checkArgument(boolean expression, String errorMessage); static void rethrowException(Exception e); @Nullable static T firstNotNull(T obj1, T obj2); static boolean canInstantiate(Class<?> clazz);  }