|
13 | 13 |
|
14 | 14 | import org.junit.jupiter.api.Test; |
15 | 15 |
|
| 16 | +import io.github.easy4j.kimi.KimiAuthenticationException; |
| 17 | +import io.github.easy4j.kimi.KimiConfigurationException; |
| 18 | +import io.github.easy4j.kimi.KimiErrorCategory; |
16 | 19 | import io.github.easy4j.kimi.KimiException; |
| 20 | +import io.github.easy4j.kimi.KimiProcessException; |
| 21 | +import io.github.easy4j.kimi.KimiProtocolException; |
| 22 | +import io.github.easy4j.kimi.KimiRpcException; |
17 | 23 | import io.github.easy4j.kimi.KimiRuntimeClosedException; |
| 24 | +import io.github.easy4j.kimi.KimiSerializationException; |
| 25 | +import io.github.easy4j.kimi.KimiServerException; |
18 | 26 | import io.github.easy4j.kimi.KimiTimeoutException; |
19 | 27 | import io.github.easy4j.kimi.KimiUnsupportedCapabilityException; |
20 | 28 |
|
@@ -67,5 +75,29 @@ void shouldKeepRuntimeExceptionsCompatibleWithKimiException() { |
67 | 75 |
|
68 | 76 | assertTrue(closed instanceof KimiException); |
69 | 77 | assertTrue(timeout instanceof KimiException); |
| 78 | + assertEquals(KimiErrorCategory.RUNTIME_CLOSED, closed.getCategory()); |
| 79 | + assertEquals(KimiErrorCategory.TIMEOUT, timeout.getCategory()); |
| 80 | + } |
| 81 | + |
| 82 | + @Test |
| 83 | + void shouldExposeStableExceptionTaxonomy() { |
| 84 | + assertEquals(KimiErrorCategory.CONFIGURATION, |
| 85 | + new KimiConfigurationException("configuration").getCategory()); |
| 86 | + assertEquals(KimiErrorCategory.PROCESS, |
| 87 | + new KimiProcessException("process").getCategory()); |
| 88 | + assertEquals(KimiErrorCategory.PROTOCOL, |
| 89 | + new KimiProtocolException("protocol").getCategory()); |
| 90 | + assertEquals(KimiErrorCategory.RPC, |
| 91 | + new KimiRpcException("rpc").getCategory()); |
| 92 | + assertEquals(KimiErrorCategory.AUTHENTICATION, |
| 93 | + new KimiAuthenticationException("auth").getCategory()); |
| 94 | + assertEquals(KimiErrorCategory.SERVER, |
| 95 | + new KimiServerException("server").getCategory()); |
| 96 | + assertEquals(KimiErrorCategory.SERIALIZATION, |
| 97 | + new KimiSerializationException("serialization").getCategory()); |
| 98 | + |
| 99 | + KimiUnsupportedCapabilityException unsupported = |
| 100 | + new KimiUnsupportedCapabilityException(KimiCapability.WEBSOCKET); |
| 101 | + assertEquals(KimiErrorCategory.UNSUPPORTED_CAPABILITY, unsupported.getCategory()); |
70 | 102 | } |
71 | 103 | } |
0 commit comments