java - 如何使用 Groovy + Spock 使用嵌套映射器测试 mapstruct 映射器
问题描述
我想在没有任何 Spring Boot 上下文的情况下使用 Groovy + Spock 测试带有嵌套映射器的 mapstruct 映射器。怎么做?
我的映射器:
@Mapper(uses = {
PathToPathDto.class,
businessToSmallBusinessDto.class,
StoreToStoreDto.class
}, componentModel = "spring")
public interface WindowDtoMapper {
WindowDtoMapper INSTANCE = Mappers.getMapper(WindowDtoMapper.class);
WindowInDetailsDto mapToWindowInDetailsDto(Window window);
WindowReadDto mapToWindowReadDto(Window window);
}
我在“使用”部分的所有嵌套映射器都是相似的:
@Mapper(componentModel = "spring")
public interface PathToPathDto {
解决方案
推荐阅读
- c# - 为什么队列消耗这么多内存?
- visual-studio - 在 VS 2019 中部署驱动程序失败
- triggers - trigger on opportunity whenever the data of the field get changed in the Custommetadata, then update that field data on the related Account field
- python - 从字典中查找python中最大的3个数字
- r - 我如何在 R 中表示这个几何级数?
- python - 如何在与子进程相同的目录中使用python调用脚本?
- javascript - 创建了一个罐头幻灯片(JS 和 JQuery),但移动罐头有困难
- css - 如果内部跨度文本为空,则通过 CSS 隐藏锚标记
- swift - AVAudioPlayer.play() 有效,但 AVAudioPlayerNode.play() 失败
- c++ - 移位运算符如何在c ++中处理负数