@@ -233,7 +233,11 @@ public void shouldBeAbleToCalculateMessageSize() {
233233
234234 TrackMessage bigMessage =
235235 TrackMessage .builder ("Big Event" ).userId ("bar" ).properties (properties ).build ();
236- client .enqueue (bigMessage );
236+ try {
237+ client .enqueue (bigMessage );
238+ } catch (IllegalArgumentException e ) {
239+ assertThat (e ).isExactlyInstanceOf (e .getClass ());
240+ }
237241
238242 // can't test for exact size cause other attributes come in play
239243 assertThat (client .messageSizeInBytes (bigMessage )).isGreaterThan (1024 * 33 );
@@ -248,7 +252,11 @@ public void dontFlushUntilReachesMaxSize() throws InterruptedException {
248252
249253 TrackMessage bigMessage =
250254 TrackMessage .builder ("Big Event" ).userId ("bar" ).properties (properties ).build ();
251- client .enqueue (bigMessage );
255+ try {
256+ client .enqueue (bigMessage );
257+ } catch (IllegalArgumentException e ) {
258+ // throw new InterruptedException(e.getMessage());
259+ }
252260
253261 wait (messageQueue );
254262
@@ -674,7 +682,7 @@ public void checkForIndividualMessageSizeLessThanLimit() {
674682
675683 /** Individual Size check sad path regular chars (over the limit) */
676684 @ Test
677- public void checkForIndividualMessageSizeOverLimit () {
685+ public void checkForIndividualMessageSizeOverLimit () throws IllegalArgumentException {
678686 AnalyticsClient client = newClient ();
679687 int msgSize = MAX_MSG_SIZE + 1 ; // BARELY over the limit
680688 int sizeLimit = MAX_MSG_SIZE ; // 32KB = 32768
@@ -684,7 +692,11 @@ public void checkForIndividualMessageSizeOverLimit() {
684692
685693 TrackMessage bigMessage =
686694 TrackMessage .builder ("Event" ).userId ("jorgen25" ).properties (properties ).build ();
687- client .enqueue (bigMessage );
695+ try {
696+ client .enqueue (bigMessage );
697+ } catch (IllegalArgumentException e ) {
698+ assertThat (e ).isExactlyInstanceOf (e .getClass ());
699+ }
688700
689701 int msgActualSize = client .messageSizeInBytes (bigMessage );
690702 assertThat (msgActualSize ).isGreaterThan (sizeLimit );
@@ -720,7 +732,12 @@ public void checkForIndividualMessageSizeSpecialCharsAboveLimit() {
720732
721733 TrackMessage bigMessage =
722734 TrackMessage .builder ("Event" ).userId ("jorgen25" ).properties (properties ).build ();
723- client .enqueue (bigMessage );
735+
736+ try {
737+ client .enqueue (bigMessage );
738+ } catch (IllegalArgumentException e ) {
739+ assertThat (e ).isExactlyInstanceOf (e .getClass ());
740+ }
724741
725742 int msgActualSize = client .messageSizeInBytes (bigMessage );
726743 assertThat (msgActualSize ).isGreaterThan (sizeLimit );
@@ -771,7 +788,7 @@ public void enqueueVerifyRegularMessageIsEnqueuedAndCheckedForSize(MessageBuilde
771788 */
772789 @ Test
773790 public void enqueueSingleMessageAboveLimitWhenNotShutdown (MessageBuilderTest builder )
774- throws InterruptedException {
791+ throws InterruptedException , IllegalArgumentException {
775792 AnalyticsClient client = newClient ();
776793
777794 // Message is above batch limit
@@ -781,7 +798,11 @@ public void enqueueSingleMessageAboveLimitWhenNotShutdown(MessageBuilderTest bui
781798 Message message =
782799 builder .get ().userId ("foo" ).integrationOptions ("someKey" , integrationOpts ).build ();
783800
784- client .enqueue (message );
801+ try {
802+ client .enqueue (message );
803+ } catch (IllegalArgumentException e ) {
804+ assertThat (e ).isExactlyInstanceOf (e .getClass ());
805+ }
785806
786807 wait (messageQueue );
787808
@@ -793,7 +814,7 @@ public void enqueueSingleMessageAboveLimitWhenNotShutdown(MessageBuilderTest bui
793814
794815 @ Test
795816 public void enqueueVerifyRegularMessagesSpecialCharactersBelowLimit (MessageBuilderTest builder )
796- throws InterruptedException {
817+ throws InterruptedException , IllegalArgumentException {
797818 AnalyticsClient client = newClient ();
798819 int msgSize = 1024 * 18 ; // 18KB
799820
@@ -828,7 +849,7 @@ public void enqueueVerifyRegularMessagesSpecialCharactersBelowLimit(MessageBuild
828849 * @throws InterruptedException
829850 */
830851 @ Test
831- public void submitBatchBelowThreshold () throws InterruptedException {
852+ public void submitBatchBelowThreshold () throws InterruptedException , IllegalArgumentException {
832853 AnalyticsClient client =
833854 new AnalyticsClient (
834855 messageQueue ,
@@ -868,7 +889,7 @@ public void submitBatchBelowThreshold() throws InterruptedException {
868889 * @throws InterruptedException
869890 */
870891 @ Test
871- public void submitBatchAboveThreshold () throws InterruptedException {
892+ public void submitBatchAboveThreshold () throws InterruptedException , IllegalArgumentException {
872893 AnalyticsClient client =
873894 new AnalyticsClient (
874895 messageQueue ,
0 commit comments