@Test public void testThrowIfNonEmpty() throws MergingException{ MergingException.throwIfNonEmpty(ImmutableList.<Message>of()); try { MergingException.throwIfNonEmpty(ImmutableList.<Message>of( new Message(Message.Kind.ERROR, "Message", SourceFilePosition.UNKNOWN))); fail(); } catch (MergingException e) { } }
public static void throwIfNonEmpty(Collection<Message> messages) throws MergingException { if (!messages.isEmpty()) { throw new MergingException(null, Iterables.toArray(messages, Message.class)); } }
MergingException extends Exception { public static void throwIfNonEmpty(Collection<Message> messages) throws MergingException { if (!messages.isEmpty()) { throw new MergingException(null, Iterables.toArray(messages, Message.class)); } } }
MergingException extends Exception { public static void throwIfNonEmpty(Collection<Message> messages) throws MergingException { if (!messages.isEmpty()) { throw new MergingException(null, Iterables.toArray(messages, Message.class)); } } protected  MergingException(@Nullable Throwable cause, @NonNull Message... messages); }
MergingException extends Exception { public static void throwIfNonEmpty(Collection<Message> messages) throws MergingException { if (!messages.isEmpty()) { throw new MergingException(null, Iterables.toArray(messages, Message.class)); } } protected  MergingException(@Nullable Throwable cause, @NonNull Message... messages); static Builder wrapException(@NonNull Throwable cause); static Builder withMessage(@Nullable String message, Object... args); static void throwIfNonEmpty(Collection<Message> messages); List<Message> getMessages(); @Override String getMessage(); @Override String toString(); }
MergingException extends Exception { public static void throwIfNonEmpty(Collection<Message> messages) throws MergingException { if (!messages.isEmpty()) { throw new MergingException(null, Iterables.toArray(messages, Message.class)); } } protected  MergingException(@Nullable Throwable cause, @NonNull Message... messages); static Builder wrapException(@NonNull Throwable cause); static Builder withMessage(@Nullable String message, Object... args); static void throwIfNonEmpty(Collection<Message> messages); List<Message> getMessages(); @Override String getMessage(); @Override String toString(); static final String MULTIPLE_ERRORS; }