@Test public void safeGetString_generatesError() { final String text = ReplicantUtil.safeGetString( () -> { throw new RuntimeException( "X" ); } ); assertTrue( text.startsWith( "Exception generated whilst attempting to get supplied message.\n" + "java.lang.RuntimeException: X\n" ) ); }
@Nonnull static String safeGetString( @Nonnull final Supplier<String> message ) { try { return message.get(); } catch ( final Throwable t ) { return "Exception generated whilst attempting to get supplied message.\n" + throwableToString( t ); } }
ReplicantUtil { @Nonnull static String safeGetString( @Nonnull final Supplier<String> message ) { try { return message.get(); } catch ( final Throwable t ) { return "Exception generated whilst attempting to get supplied message.\n" + throwableToString( t ); } } }
ReplicantUtil { @Nonnull static String safeGetString( @Nonnull final Supplier<String> message ) { try { return message.get(); } catch ( final Throwable t ) { return "Exception generated whilst attempting to get supplied message.\n" + throwableToString( t ); } } private  ReplicantUtil(); }
ReplicantUtil { @Nonnull static String safeGetString( @Nonnull final Supplier<String> message ) { try { return message.get(); } catch ( final Throwable t ) { return "Exception generated whilst attempting to get supplied message.\n" + throwableToString( t ); } } private  ReplicantUtil();  }
ReplicantUtil { @Nonnull static String safeGetString( @Nonnull final Supplier<String> message ) { try { return message.get(); } catch ( final Throwable t ) { return "Exception generated whilst attempting to get supplied message.\n" + throwableToString( t ); } } private  ReplicantUtil();   }