如何在CodeModel中获取Assert JClass?

时间:2011-08-08 21:58:15

标签: java junit assert sun-codemodel

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

1 个答案:

答案 0 :(得分:2)

我想我找到了它:

    import com.sun.codemodel.JCodeModel;
    import org.junit.Assert;
    ...

    JCodeModel jcm = new JCodeModel();
    assertClass = jcm.ref(Assert.class);