【问题标题】:How to obtain the Assert JClass in CodeModel?CodeModel中如何获取Assert JClass?
【发布时间】:2011-08-08 21:58:15
【问题描述】:

org.junit 包定义了用于 JUnit 测试的 Assert 类。如何在CodeModel 框架中将这个静态类作为JClass 检索?

【问题讨论】:

    标签: java junit assert sun-codemodel


    【解决方案1】:

    我想我找到了:

        import com.sun.codemodel.JCodeModel;
        import org.junit.Assert;
        ...
    
        JCodeModel jcm = new JCodeModel();
        assertClass = jcm.ref(Assert.class);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多