读书人

java 相关有关问题(三)

发布时间: 2012-09-03 09:48:39 作者: rapoo

java 相关问题(三)
十三、java 实现 调用 打印机 代码详解

??? 接口 PrintService 是 DocPrintJob 的工厂。PrintService 描述了打印机的功能,并可查询它来了解打印机支持的属性。

?

?

java 相关有关问题(三)

?

java 相关有关问题(三)

?

?

java 相关有关问题(三)

?

?

?? 接口 PrintService 是 DocPrintJob 的工厂。PrintService 描述了打印机的功能,并可查询它来了解打印机支持的属性。

?

?

?

?

十四、JUnit 测试全部 case (TestSuite)

??? 如果你不想要 TestRunner 找出的 testXXX()方法行,可以使用TestSuite 合你想要行的。例如:

??? 正如先前的例,此在TestSuite的建式中,以反射找出所有testXXX()方法、建立TestCase例加入TestSuite中。

??? 所以基本上,真正用合元是TestSuite。TestSuite的addTest()接受的是Test介面的作物件,所以TestCaseTestSuite都可以加入某TestSuite中,另一addTestSuite()方法名有令人困惑,它非接受TestSuite的例,而是接受Class的例,而它只不是代建立TestSuite的便方法:

public void run(TestResult result) {    for (Enumeration e= tests(); e.hasMoreElements(); ) {        if (result.shouldStop() )            break;        Test test= (Test)e.nextElement();            runTest(test, result);    }}public void runTest(Test test, TestResult result) {    test.run(result);}
?


?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

读书人网 >其他相关

热点推荐