// Path: pipeline-application/src/main/java/com/smoketurner/pipeline/application/exceptions/AmazonS3ConstraintException.java
// public class AmazonS3ConstraintException extends Exception {
// 
//   private static final long serialVersionUID = 1L;
// 
//   public AmazonS3ConstraintException() {
//     super();
//   }
// 
//   public AmazonS3ConstraintException(final Throwable cause) {
//     super(cause);
//   }
// 
//   public AmazonS3ConstraintException(final String message) {
//     super(message);
//   }
// 
//   public AmazonS3ConstraintException(final String message, final Throwable cause) {
//     super(message, cause);
//   }
// }
// 
// Path: pipeline-application/src/main/java/com/smoketurner/pipeline/application/exceptions/AmazonS3ZeroSizeException.java
// public class AmazonS3ZeroSizeException extends Exception {
// 
//   private static final long serialVersionUID = 1L;
// 
//   public AmazonS3ZeroSizeException() {
//     super();
//   }
// 
//   public AmazonS3ZeroSizeException(final Throwable cause) {
//     super(cause);
//   }
// 
//   public AmazonS3ZeroSizeException(final String message) {
//     super(message);
//   }
// 
//   public AmazonS3ZeroSizeException(final String message, final Throwable cause) {
//     super(message, cause);
//   }
// }


import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.services.s3.event.S3EventNotification.S3EventNotificationRecord;
import com.amazonaws.services.s3.model.ObjectMetadata;
import com.amazonaws.services.s3.model.S3Object;
import com.amazonaws.services.s3.model.S3ObjectInputStream;
import com.amazonaws.services.sqs.model.Message;
import com.google.common.io.Resources;
import com.smoketurner.pipeline.application.exceptions.AmazonS3ConstraintException;
import com.smoketurner.pipeline.application.exceptions.AmazonS3ZeroSizeException;
import io.dropwizard.testing.FixtureHelpers;
import org.apache.http.client.methods.HttpRequestBase;
import org.glassfish.jersey.media.sse.OutboundEvent;
import org.junit.Before;
import org.junit.Test;
  public void testProcessS3EventFetchFailure() throws Exception {
    when(broadcaster.isEmpty()).thenReturn(false);
    when(s3.fetch(any(S3EventNotificationRecord.class)))
        .thenThrow(new AmazonServiceException("error"));

    message.setBody(FixtureHelpers.fixture("fixtures/sns_notification.json"));
    final boolean actual = processor.test(message);

    verify(broadcaster, times(2)).isEmpty();
    verify(broadcaster, never()).test(anyString());
    verify(s3).fetch(any(S3EventNotificationRecord.class));
    assertThat(actual).isFalse();
  }

  @Test
  public void testProcessNoConnectionsAfterParse() throws Exception {
    when(broadcaster.isEmpty()).thenReturn(false, true);

    message.setBody(FixtureHelpers.fixture("fixtures/sns_notification.json"));
    final boolean actual = processor.test(message);

    verify(broadcaster, times(2)).isEmpty();
    verify(broadcaster, never()).test(anyString());
    verify(s3, never()).fetch(any(S3EventNotificationRecord.class));
    assertThat(actual).isFalse();
  }

  @Test
  public void testProcessS3ZeroSizeFailure() throws Exception {
    when(broadcaster.isEmpty()).thenReturn(false);
// Path: pipeline-application/src/main/java/com/smoketurner/pipeline/application/exceptions/AmazonS3ConstraintException.java
// public class AmazonS3ConstraintException extends Exception {
// 
//   private static final long serialVersionUID = 1L;
// 
//   public AmazonS3ConstraintException() {
//     super();
//   }
// 
//   public AmazonS3ConstraintException(final Throwable cause) {
//     super(cause);
//   }
// 
//   public AmazonS3ConstraintException(final String message) {
//     super(message);
//   }
// 
//   public AmazonS3ConstraintException(final String message, final Throwable cause) {
//     super(message, cause);
//   }
// }
// 
// Path: pipeline-application/src/main/java/com/smoketurner/pipeline/application/exceptions/AmazonS3ZeroSizeException.java
// public class AmazonS3ZeroSizeException extends Exception {
// 
//   private static final long serialVersionUID = 1L;
// 
//   public AmazonS3ZeroSizeException() {
//     super();
//   }
// 
//   public AmazonS3ZeroSizeException(final Throwable cause) {
//     super(cause);
//   }
// 
//   public AmazonS3ZeroSizeException(final String message) {
//     super(message);
//   }
// 
//   public AmazonS3ZeroSizeException(final String message, final Throwable cause) {
//     super(message, cause);
//   }
// }


// Path: pipeline-application/src/test/java/com/smoketurner/pipeline/application/core/MessageProcessorTest.java
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.services.s3.event.S3EventNotification.S3EventNotificationRecord;
import com.amazonaws.services.s3.model.ObjectMetadata;
import com.amazonaws.services.s3.model.S3Object;
import com.amazonaws.services.s3.model.S3ObjectInputStream;
import com.amazonaws.services.sqs.model.Message;
import com.google.common.io.Resources;
import com.smoketurner.pipeline.application.exceptions.AmazonS3ConstraintException;
import com.smoketurner.pipeline.application.exceptions.AmazonS3ZeroSizeException;
import io.dropwizard.testing.FixtureHelpers;
import org.apache.http.client.methods.HttpRequestBase;
import org.glassfish.jersey.media.sse.OutboundEvent;
import org.junit.Before;
import org.junit.Test;

  public void testProcessS3EventFetchFailure() throws Exception {
    when(broadcaster.isEmpty()).thenReturn(false);
    when(s3.fetch(any(S3EventNotificationRecord.class)))
        .thenThrow(new AmazonServiceException("error"));

    message.setBody(FixtureHelpers.fixture("fixtures/sns_notification.json"));
    final boolean actual = processor.test(message);

    verify(broadcaster, times(2)).isEmpty();
    verify(broadcaster, never()).test(anyString());
    verify(s3).fetch(any(S3EventNotificationRecord.class));
    assertThat(actual).isFalse();
  }

  @Test
  public void testProcessNoConnectionsAfterParse() throws Exception {
    when(broadcaster.isEmpty()).thenReturn(false, true);

    message.setBody(FixtureHelpers.fixture("fixtures/sns_notification.json"));
    final boolean actual = processor.test(message);

    verify(broadcaster, times(2)).isEmpty();
    verify(broadcaster, never()).test(anyString());
    verify(s3, never()).fetch(any(S3EventNotificationRecord.class));
    assertThat(actual).isFalse();
  }

  @Test
  public void testProcessS3ZeroSizeFailure() throws Exception {
    when(broadcaster.isEmpty()).thenReturn(false);
    when(s3.fetch(any(S3EventNotificationRecord.class))).thenThrow(new AmazonS3ZeroSizeException());