ImmutabilityTest.java 文件源码

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

项目:typed-github 作者:
/**
 * Test for immutability.
 * Checks that all classes in package {@code com.jcabi.github }
 * have {@code @Immutable} annotation.
 *
 * @throws Exception If some problem inside
 */
@Test
public void checkImmutability() throws Exception {
    MatcherAssert.assertThat(
        Iterables.filter(
            this.classpath.allTypes(),
            new Predicate<Class<?>>() {
                @Override
                public boolean apply(final Class<?> input) {
                    return !ImmutabilityTest.skip().contains(
                        input.getName()
                    );
                }
            }
        ),
        Matchers.everyItem(
            new CustomTypeSafeMatcher<Class<?>>("annotated type") {
                @Override
                protected boolean matchesSafely(final Class<?> item) {
                    return item.isAnnotationPresent(Immutable.class);
                }
            }
        )
    );
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号