Merge remote-tracking branch 'origin/master'
						commit
						f5846b0a6c
					
				| 
						 | 
					@ -46,5 +46,12 @@
 | 
				
			||||||
            <groupId>com.google.guava</groupId>
 | 
					            <groupId>com.google.guava</groupId>
 | 
				
			||||||
            <artifactId>guava</artifactId>
 | 
					            <artifactId>guava</artifactId>
 | 
				
			||||||
        </dependency>
 | 
					        </dependency>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <!-- Test 测试相关 -->
 | 
				
			||||||
 | 
					        <dependency>
 | 
				
			||||||
 | 
					            <groupId>cn.iocoder.cloud</groupId>
 | 
				
			||||||
 | 
					            <artifactId>yudao-spring-boot-starter-test</artifactId>
 | 
				
			||||||
 | 
					            <scope>test</scope>
 | 
				
			||||||
 | 
					        </dependency>
 | 
				
			||||||
    </dependencies>
 | 
					    </dependencies>
 | 
				
			||||||
</project>
 | 
					</project>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,50 @@
 | 
				
			||||||
 | 
					package cn.iocoder.yudao.framework.datapermission.core.util;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.framework.common.pojo.CommonResult;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
 | 
				
			||||||
 | 
					import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO;
 | 
				
			||||||
 | 
					import org.junit.jupiter.api.BeforeEach;
 | 
				
			||||||
 | 
					import org.junit.jupiter.api.Test;
 | 
				
			||||||
 | 
					import org.mockito.Mock;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
 | 
				
			||||||
 | 
					import static org.junit.jupiter.api.Assertions.assertEquals;
 | 
				
			||||||
 | 
					import static org.mockito.Mockito.when;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * {@link DictFrameworkUtils} 的单元测试
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					public class DictFrameworkUtilsTest extends BaseMockitoUnitTest {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Mock
 | 
				
			||||||
 | 
					    private DictDataApi dictDataApi;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @BeforeEach
 | 
				
			||||||
 | 
					    public void setUp() {
 | 
				
			||||||
 | 
					        DictFrameworkUtils.init(dictDataApi);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Test
 | 
				
			||||||
 | 
					    public void testGetDictDataLabel() {
 | 
				
			||||||
 | 
					        // mock 数据
 | 
				
			||||||
 | 
					        DictDataRespDTO dataRespDTO = randomPojo(DictDataRespDTO.class, o -> o.setStatus(CommonStatusEnum.ENABLE.getStatus()));
 | 
				
			||||||
 | 
					        // mock 方法
 | 
				
			||||||
 | 
					        when(dictDataApi.getDictData(dataRespDTO.getDictType(), dataRespDTO.getValue())).thenReturn(CommonResult.success(dataRespDTO));
 | 
				
			||||||
 | 
					        // 断言返回值
 | 
				
			||||||
 | 
					        assertEquals(dataRespDTO.getLabel(), DictFrameworkUtils.getDictDataLabel(dataRespDTO.getDictType(), dataRespDTO.getValue()));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Test
 | 
				
			||||||
 | 
					    public void testParseDictDataValue() {
 | 
				
			||||||
 | 
					        // mock 数据
 | 
				
			||||||
 | 
					        DictDataRespDTO resp = randomPojo(DictDataRespDTO.class, o -> o.setStatus(CommonStatusEnum.ENABLE.getStatus()));
 | 
				
			||||||
 | 
					        // mock 方法
 | 
				
			||||||
 | 
					        when(dictDataApi.parseDictData(resp.getDictType(), resp.getLabel())).thenReturn(CommonResult.success(resp));
 | 
				
			||||||
 | 
					        // 断言返回值
 | 
				
			||||||
 | 
					        assertEquals(resp.getValue(), DictFrameworkUtils.parseDictDataValue(resp.getDictType(), resp.getLabel()));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -29,7 +29,7 @@ public @interface OperateLog {
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 操作名
 | 
					     * 操作名
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * 为空时,会尝试读取 {@link ApiOperation#value()} 属性
 | 
					     * 为空时,会尝试读取 {@link Operation#summary()} 属性
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    String name() default "";
 | 
					    String name() default "";
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,7 +20,7 @@ public abstract class AbstractBusProducer {
 | 
				
			||||||
    @Resource
 | 
					    @Resource
 | 
				
			||||||
    protected ServiceMatcher serviceMatcher;
 | 
					    protected ServiceMatcher serviceMatcher;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Value("{spring.application.name}")
 | 
					    @Value("${spring.application.name}")
 | 
				
			||||||
    protected String applicationName;
 | 
					    protected String applicationName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    protected void publishEvent(RemoteApplicationEvent event) {
 | 
					    protected void publishEvent(RemoteApplicationEvent event) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue