java类org.jsonschema2pojo.NoopAnnotator的实例源码

Jsonschema2PojoMojo.java 文件源码 项目:GitHub 阅读 30 收藏 0 点赞 0 评论 0
@Override
@SuppressWarnings("unchecked")
public Class<? extends Annotator> getCustomAnnotator() {
    if (isNotBlank(customAnnotator)) {
        try {
            return (Class<? extends Annotator>) Class.forName(customAnnotator);
        } catch (ClassNotFoundException e) {
            throw new IllegalArgumentException(e);
        }
    } else {
        return NoopAnnotator.class;
    }
}
Jsonschema2PojoTask.java 文件源码 项目:GitHub 阅读 30 收藏 0 点赞 0 评论 0
/**
 * Sets the 'customAnnotator' property of this class
 *
 * @param customAnnotator
 *            A custom annotator to use to annotate the generated types
 */
@SuppressWarnings("unchecked")
public void setCustomAnnotator(String customAnnotator) {
    if (isNotBlank(customAnnotator)) {
        try {
            this.customAnnotator = (Class<? extends Annotator>) Class.forName(customAnnotator);
        } catch (ClassNotFoundException e) {
            throw new IllegalArgumentException(e);
        }
    } else {
        this.customAnnotator = NoopAnnotator.class;
    }
}
RuleFactoryImplTest.java 文件源码 项目:GitHub 阅读 29 收藏 0 点赞 0 评论 0
@Test
public void generationConfigIsReturned() {

    GenerationConfig mockGenerationConfig = mock(GenerationConfig.class);

    RuleFactory ruleFactory = new RuleFactory(mockGenerationConfig, new NoopAnnotator(), new SchemaStore());

    assertThat(ruleFactory.getGenerationConfig(), is(sameInstance(mockGenerationConfig)));

}
RuleFactoryImplTest.java 文件源码 项目:GitHub 阅读 29 收藏 0 点赞 0 评论 0
@Test
public void schemaStoreIsReturned() {

    SchemaStore mockSchemaStore = mock(SchemaStore.class);

    RuleFactory ruleFactory = new RuleFactory(new DefaultGenerationConfig(), new NoopAnnotator(), mockSchemaStore);

    assertThat(ruleFactory.getSchemaStore(), is(sameInstance(mockSchemaStore)));

}


问题


面经


文章

微信
公众号

扫码关注公众号