|
28 | 28 | import java.time.Duration; |
29 | 29 | import java.util.Map; |
30 | 30 | import java.util.concurrent.ConcurrentHashMap; |
31 | | -import org.junit.Assert; |
32 | | -import org.junit.Rule; |
33 | | -import org.junit.Test; |
| 31 | +import org.junit.*; |
34 | 32 |
|
35 | 33 | public class OperationFailMetricTest { |
36 | 34 | private static final Map<String, Integer> invocationCount = new ConcurrentHashMap<>(); |
@@ -212,7 +210,6 @@ public void cancelOperationApplicationErrorMetrics() { |
212 | 210 | Assert.assertEquals("foo", applicationFailure.getDetails().get(String.class)); |
213 | 211 | } else { |
214 | 212 | Assert.assertEquals("intentional cancel", canceledFailure.getOriginalMessage()); |
215 | | - Assert.assertEquals(1, canceledFailure.getDetails().getSize()); |
216 | 213 | } |
217 | 214 |
|
218 | 215 | Map<String, String> execFailedTags = |
@@ -379,8 +376,6 @@ public void failHandlerMessageAppBadRequestMetrics() { |
379 | 376 | Assert.assertEquals(HandlerException.ErrorType.BAD_REQUEST, handlerException.getErrorType()); |
380 | 377 | if (isUsingNewFormat()) { |
381 | 378 | Assert.assertEquals("handler failure message", handlerException.getMessage()); |
382 | | - } else { |
383 | | - Assert.assertEquals("intentional failure", handlerException.getMessage()); |
384 | 379 | } |
385 | 380 | Assert.assertTrue(handlerException.getCause() instanceof ApplicationFailure); |
386 | 381 | ApplicationFailure applicationFailure = (ApplicationFailure) handlerException.getCause(); |
@@ -484,9 +479,8 @@ public void failHandlerNonRetryableApplicationFailureMetrics() { |
484 | 479 | Assert.assertEquals( |
485 | 480 | HandlerException.RetryBehavior.NON_RETRYABLE, handlerFailure.getRetryBehavior()); |
486 | 481 | Assert.assertNotNull(failure.getCause()); |
487 | | - failure = (Exception) failure.getCause(); |
488 | 482 | } |
489 | | - |
| 483 | + failure = (Exception) failure.getCause(); |
490 | 484 | Assert.assertTrue(failure.getMessage().contains("intentional failure")); |
491 | 485 |
|
492 | 486 | Map<String, String> execFailedTags = |
@@ -561,7 +555,9 @@ public void handlerErrorNonRetryableMetrics() { |
561 | 555 | assertNoRetries("handlererror-nonretryable"); |
562 | 556 | HandlerException handlerFailure = |
563 | 557 | assertNexusOperationFailure(HandlerException.class, workflowException); |
564 | | - Assert.assertTrue(handlerFailure.getMessage().contains("intentional failure")); |
| 558 | + if (isUsingNewFormat()) { |
| 559 | + Assert.assertTrue(handlerFailure.getMessage().contains("intentional failure")); |
| 560 | + } |
565 | 561 | Assert.assertEquals(HandlerException.ErrorType.INTERNAL, handlerFailure.getErrorType()); |
566 | 562 | Assert.assertEquals( |
567 | 563 | HandlerException.RetryBehavior.NON_RETRYABLE, handlerFailure.getRetryBehavior()); |
|
0 commit comments