@Test
public void mapGraphValue_ReturnsResults_WhenRefCanBeResolved() {
// Arrange
property.set$ref(DUMMY_REF);
Model refModel = new ModelImpl();
refModel.setProperties(ImmutableMap.of(KEY_1, PROPERTY_1, KEY_2, PROPERTY_2));
when(entityBuilderContext.getLdPathExecutor()).thenReturn(ldPathExecutor);
when(entityBuilderContext.getSwaggerDefinitions()).thenReturn(
ImmutableMap.of(property.getSimpleRef(), refModel));
when(ldPathExecutor.ldPathQuery(context, LD_PATH_QUERY)).thenReturn(ImmutableList.of(VALUE_2));
// Act
Map<String, Object> result =
(Map<String, Object>) schemaMapper.mapGraphValue(property, entityBuilderContext,
ValueContext.builder().value(context).build(), schemaMapperAdapter);
// Assert
assertThat(result.keySet(), hasSize(2));
assertEquals(((Optional) result.get(KEY_1)).orNull(), VALUE_1.stringValue());
assertEquals(((Optional) result.get(KEY_2)).orNull(), VALUE_2.intValue());
}
RefSchemaMapperTest.java 文件源码
java
阅读 33
收藏 0
点赞 0
评论 0
项目:dotwebstack-framework
作者:
评论列表
文章目录