DefaultClientBuilderTest.java 文件源码

java
阅读 18 收藏 0 点赞 0 评论 0

项目:aws-sdk-java-v2 作者:
@Test
public void clientBuilderFieldsHaveBeanEquivalents() throws Exception {
    ClientBuilder<TestClientBuilder, TestClient> builder = testClientBuilder();

    BeanInfo beanInfo = Introspector.getBeanInfo(builder.getClass());
    Method[] clientBuilderMethods = ClientBuilder.class.getDeclaredMethods();

    Arrays.stream(clientBuilderMethods).filter(m -> !m.isSynthetic()).forEach(builderMethod -> {
        String propertyName = builderMethod.getName();

        Optional<PropertyDescriptor> propertyForMethod =
                Arrays.stream(beanInfo.getPropertyDescriptors())
                      .filter(property -> property.getName().equals(propertyName))
                      .findFirst();

        assertThat(propertyForMethod).as(propertyName + " property").hasValueSatisfying(property -> {
            assertThat(property.getReadMethod()).as(propertyName + " getter").isNull();
            assertThat(property.getWriteMethod()).as(propertyName + " setter").isNotNull();
        });
    });

}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号