@Test public void errorCodes() {

  assertThat(DubboParser.errorCode(null))
      .isEqualTo(DubboParser.errorCode(new IOException("timeout")))
      .isNull();
  assertThat(DubboParser.errorCode(new RpcException(0)))
      .isEqualTo("UNKNOWN_EXCEPTION");
  assertThat(DubboParser.errorCode(new RpcException(1)))
      .isEqualTo("NETWORK_EXCEPTION");
  assertThat(DubboParser.errorCode(new RpcException(2)))
      .isEqualTo("TIMEOUT_EXCEPTION");
  assertThat(DubboParser.errorCode(new RpcException(3)))
      .isEqualTo("BIZ_EXCEPTION");
  assertThat(DubboParser.errorCode(new RpcException(4)))
      .isEqualTo("FORBIDDEN_EXCEPTION");
  assertThat(DubboParser.errorCode(new RpcException(5)))
      .isEqualTo("SERIALIZATION_EXCEPTION");
  assertThat(DubboParser.errorCode(new RpcException(6)))
      .isEqualTo("NO_INVOKER_AVAILABLE_AFTER_FILTER");
  assertThat(DubboParser.errorCode(new RpcException(7)))
      .isEqualTo("LIMIT_EXCEEDED_EXCEPTION");
  assertThat(DubboParser.errorCode(new RpcException(8)))
      .isEqualTo("TIMEOUT_TERMINATE");
  assertThat(DubboParser.errorCode(new RpcException(9)))
      .isNull(); // This test will drift with a new error code name if Dubbo adds one.
}