BrokersResult { public void error(Exception e) { if (!started.get()) { throw new IllegalStateException( "Submitting a broker error is not allowed before calling BrokerResult#get"); } future.completeExceptionally(e); } BrokersResult(); void error(Exception e); void setResult(List<ChePlugin> toolingFromBroker); List<ChePlugin> get(long waitTime, TimeUnit tu);  }
@Test( expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = "Submitting a broker error is not allowed before calling BrokerResult#get") public void shouldThrowExceptionOnCallingErrorBeforeCallGet() { brokersResult.error(new Exception()); }