  @Test
  public void testIsAutomaticMessage() throws MessagingException {

    MimeMessage automatic = mock(MimeMessage.class);
    when(automatic.getHeader("Auto-Submitted")).thenReturn(new String[]{"bart", "auto-replied"});
    BetterMimeMessage instance = new BetterMimeMessage(automatic);
    assertTrue(instance.isAutomaticMessage());

    automatic = mock(MimeMessage.class);
    when(automatic.getHeader("Auto-Submitted")).thenReturn(new String[]{"bart", "auto-generated"});
    instance = new BetterMimeMessage(automatic);
    assertTrue(instance.isAutomaticMessage());

    automatic = mock(MimeMessage.class);
    when(automatic.getHeader("Auto-Submitted")).thenReturn(new String[]{"bart", "auto-notified; "
          + "owner-email=\"me@example.com\""});
    instance = new BetterMimeMessage(automatic);
    assertTrue(instance.isAutomaticMessage());

    automatic = mock(MimeMessage.class);
    when(automatic.getHeader("Auto-Submitted")).thenReturn(new String[]{"bart", "auto-notified; "
          + "owner-token=af3NN2pK5dDXI0W"});
    instance = new BetterMimeMessage(automatic);
    assertTrue(instance.isAutomaticMessage());
  }