|
23 | 23 | import static org.junit.Assert.assertEquals; |
24 | 24 | import static org.junit.Assert.assertFalse; |
25 | 25 | import static org.junit.Assert.assertNull; |
| 26 | +import static org.junit.Assert.assertSame; |
26 | 27 | import static org.junit.Assert.assertTrue; |
27 | 28 |
|
28 | 29 | import com.google.gcloud.BaseServiceException; |
@@ -57,7 +58,15 @@ public void testResourceManagerException() { |
57 | 58 | assertNull(exception.getMessage()); |
58 | 59 | assertTrue(exception.retryable()); |
59 | 60 | assertTrue(exception.idempotent()); |
60 | | - assertEquals(cause, exception.getCause()); |
| 61 | + assertSame(cause, exception.getCause()); |
| 62 | + |
| 63 | + exception = new ComputeException(403, "message", cause); |
| 64 | + assertEquals(403, exception.code()); |
| 65 | + assertEquals("message", exception.getMessage()); |
| 66 | + assertNull(exception.reason()); |
| 67 | + assertFalse(exception.retryable()); |
| 68 | + assertTrue(exception.idempotent()); |
| 69 | + assertSame(cause, exception.getCause()); |
61 | 70 | } |
62 | 71 |
|
63 | 72 | @Test |
@@ -88,7 +97,7 @@ public void testTranslateAndThrow() throws Exception { |
88 | 97 | assertEquals("message", ex.getMessage()); |
89 | 98 | assertFalse(ex.retryable()); |
90 | 99 | assertTrue(ex.idempotent()); |
91 | | - assertEquals(cause, ex.getCause()); |
| 100 | + assertSame(cause, ex.getCause()); |
92 | 101 | } finally { |
93 | 102 | verify(exceptionMock); |
94 | 103 | } |
|
0 commit comments