public static void checkTopicConfig(final TopicConfig topicConfig) throws MQClientException {
        if (!PermName.isValid(topicConfig.getPerm())) {
            throw new MQClientException(ResponseCode.NO_PERMISSION,
                String.format("topicPermission value: %s is invalid.", topicConfig.getPerm()));
        }
    }
@Test
    public void testTopicConfigValid() throws MQClientException {
        TopicConfig topicConfig = new TopicConfig();
        topicConfig.setPerm(PermName.PERM_INHERIT | PermName.PERM_WRITE | PermName.PERM_READ);
        Validators.checkTopicConfig(topicConfig);

        topicConfig.setPerm(PermName.PERM_WRITE | PermName.PERM_READ);
        Validators.checkTopicConfig(topicConfig);

        topicConfig.setPerm(PermName.PERM_READ);
        Validators.checkTopicConfig(topicConfig);

        try {
            topicConfig.setPerm(PermName.PERM_PRIORITY);
            Validators.checkTopicConfig(topicConfig);
        } catch (MQClientException e) {
            assertThat(e.getResponseCode()).isEqualTo(ResponseCode.NO_PERMISSION);
            assertThat(e.getErrorMessage()).isEqualTo(String.format("topicPermission value: %s is invalid.", topicConfig.getPerm()));
        }

        try {
            topicConfig.setPerm(PermName.PERM_PRIORITY | PermName.PERM_WRITE);
            Validators.checkTopicConfig(topicConfig);
        } catch (MQClientException e) {
            assertThat(e.getResponseCode()).isEqualTo(ResponseCode.NO_PERMISSION);
            assertThat(e.getErrorMessage()).isEqualTo(String.format("topicPermission value: %s is invalid.", topicConfig.getPerm()));
        }
    }