### Question:
DelayedError { public static DelayedError create(Binder binder, String message, Object... args) { return create(binder, new Message(PrettyTypes.format(message, args))); } private  DelayedError(Throwable error); static DelayedError create(Binder binder, String message, Object... args); static DelayedError create(Binder binder, Throwable t); static DelayedError create(Binder binder, Message message); void cancel();  }### Answer:
@Test public void testFormatString() { thrown.expect(CreationException.class); thrown.expectMessage("Test java.lang.String"); thrown.expectMessage(not(containsString("CreationException"))); Guice.createInjector(new AbstractModule() { @Override protected void configure() { DelayedError.create(binder(), "Test %s", new Key<String>() { }); } }); }
@Test public void testMessage() { thrown.expect(CreationException.class); thrown.expectMessage("the message"); thrown.expectMessage("at the source"); thrown.expectMessage(not(containsString("CreationException"))); Guice.createInjector(new AbstractModule() { @Override protected void configure() { DelayedError.create(binder(), new Message("the source", "the message")); } }); }
@Test public void testThrowable() { final Throwable cause = new IllegalStateException(); thrown.expect(CreationException.class); thrown.expectCause(is(cause)); Guice.createInjector(new AbstractModule() { @Override protected void configure() { DelayedError.create(binder(), cause); } }); }