MailHandler extends Handler { public final void setAttachmentFormatters(Formatter... formatters) { checkAccess(); if (formatters.length == 0) { formatters = emptyFormatterArray(); } else { formatters = copyOf(formatters, formatters.length, Formatter[].class); for (int i = 0; i < formatters.length; ++i) { if (formatters[i] == null) { throw new NullPointerException(atIndexMsg(i)); } } } synchronized (this) { if (isWriting) { throw new IllegalStateException(); } this.attachmentFormatters = formatters; this.fixUpAttachmentFilters(); this.fixUpAttachmentNames(); } } MailHandler();  MailHandler(final int capacity);  MailHandler(final Properties props); @Override boolean isLoggable(final LogRecord record); void publish(final LogRecord record); void push(); void flush(); void close(); @Override synchronized void setLevel(final Level newLevel); final synchronized Level getPushLevel(); final synchronized void setPushLevel(final Level level); final synchronized Filter getPushFilter(); final synchronized void setPushFilter(final Filter filter); final synchronized Comparator<? super LogRecord> getComparator(); final synchronized void setComparator(Comparator<? super LogRecord> c); final synchronized int getCapacity(); final synchronized Authenticator getAuthenticator(); final void setAuthenticator(final Authenticator auth); final void setAuthenticator(final char... password); final void setMailProperties(Properties props); final Properties getMailProperties(); final Filter[] getAttachmentFilters(); final void setAttachmentFilters(Filter... filters); final Formatter[] getAttachmentFormatters(); final void setAttachmentFormatters(Formatter... formatters); final Formatter[] getAttachmentNames(); final void setAttachmentNames(final String... names); final void setAttachmentNames(Formatter... formatters); final synchronized Formatter getSubject(); final void setSubject(final String subject); final void setSubject(final Formatter format);  }
@Test public void testEmpty() { MailHandler instance = createHandlerWithRecords(); instance.setFormatter(new SimpleFormatter()); instance.setAttachmentFormatters(new Formatter[]{ new EmptyFormatter(), new SimpleFormatter(), new SimpleFormatter()}); testEmpty(instance); instance = createHandlerWithRecords(); instance.setFormatter(new SimpleFormatter()); instance.setAttachmentFormatters(new Formatter[]{ new SimpleFormatter(), new EmptyFormatter(), new SimpleFormatter()}); testEmpty(instance); instance = createHandlerWithRecords(); instance.setFormatter(new SimpleFormatter()); instance.setAttachmentFormatters(new Formatter[]{ new SimpleFormatter(), new SimpleFormatter(), new EmptyFormatter()}); testEmpty(instance); instance = createHandlerWithRecords(); instance.setFormatter(new EmptyFormatter()); instance.setAttachmentFormatters(new Formatter[]{ new SimpleFormatter(), new SimpleFormatter(), new SimpleFormatter()}); testEmpty(instance); instance = createHandlerWithRecords(); instance.setFormatter(new EmptyFormatter()); instance.setAttachmentFormatters(new Formatter[]{ new SimpleFormatter(), new EmptyFormatter(), new SimpleFormatter()}); testEmpty(instance); instance = createHandlerWithRecords(); instance.setFormatter(new SimpleFormatter()); instance.setAttachmentFormatters(new Formatter[]{new EmptyFormatter()}); testEmpty(instance); instance = createHandlerWithRecords(); instance.setFormatter(new EmptyFormatter()); instance.setAttachmentFormatters(new Formatter[]{new SimpleFormatter()}); testEmpty(instance); instance = createHandlerWithRecords(); instance.setFormatter(new EmptyFormatter()); instance.setAttachmentFormatters(new Formatter[]{new EmptyFormatter()}); testEmpty(instance); instance = createHandlerWithRecords(); instance.setFormatter(new EmptyFormatter()); testEmpty(instance); }