apache / shenyu

Apache ShenYu is a Java native API Gateway for service proxy, protocol conversion and API governance.
https://shenyu.apache.org/
Apache License 2.0
8.42k stars 2.92k forks source link

Test Spring-boot-starter-plugin-alibaba-dubbo #879

Closed yu199195 closed 3 years ago

zhoubin14524 commented 3 years ago

get

Asxing commented 3 years ago
<dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
  </dependency>
  <dependency>
      <groupId>com.alibaba</groupId>
      <artifactId>dubbo</artifactId>
      <version>${alibaba.dubbo.version}</version>
      <scope>test</scope>
  </dependency>
  <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-webflux</artifactId>
      <scope>test</scope>
  </dependency
Asxing commented 3 years ago
package org.dromara.soul.spring.boot.starter.plugin.alibaba.dubbo;

import org.dromara.soul.common.enums.PluginEnum;
import org.dromara.soul.plugin.alibaba.dubbo.response.DubboResponsePlugin;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@SpringBootTest(
        classes = {
                AlibabaDubboPluginConfiguration.class,
                AlibabaDubboPluginConfigurationTest.class
        },
        webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT
)
@EnableAutoConfiguration
public class AlibabaDubboPluginConfigurationTest {

    @Autowired
    private DubboResponsePlugin dubboResponsePlugin;

    @Test
    public void testAlibabaDubboPlugin() {
        Assert.assertEquals(PluginEnum.RESPONSE.getCode(), dubboResponsePlugin.getOrder());
    }
}